Difference between Pointers and References

Pointers provide us with a benefit of avoiding duplication of data. For example if you have a structure (or Class) which you have instantiated in memory in one of your methods, and then you are trying to pass that instance to another method, then passing by value would create a copy of that instance in the called method. Instead you could pass a pointer to that instance to the called method and then both the calling and the called method would be working on the same copy of the data.

For example:

fun(){

//Assume size of Account is 20 bytes

Account a; //here Account is a structure and ‘a’ is variable not a reference

// size of ‘a’ would be 20 bytes

Account *ptr=new Account(); //ptr is a pointer

// size of ptr is 64bits (or 32bits in older systems) and it points to 20 bytes

Fun2(a); //pass by value – creates duplicate memory for ‘a’ in fun2

Fun2(ptr); //pass by pointer- uses same memory defined in fun in fun2

}

But pointers had a disadvantage from the business applications point of view. You could do pointer arithmetic i.e. you could do ptr++ which would allow you to jump by the size of the structure (20 bytes in above example) on to a memory location in the RAM which could be the memory of another process! This was potentially dangerous, although this is used when working with micro processor based closed systems such as programs in your Washing Machine or Microwave Oven where there is very small amount of personal memory available to the micro processor and poses no threat to other processes, because there are none.

So with the advent of Higher Level Languages (HLL) like Java the programming think-tank thought that they need to rid pointers of its arithmetic while keeping its benefit of avoiding memory duplication. This is when a new version of pointers minus the ++,– capability was born which we lovingly call a Reference.

3800 replies
  1. tadalafil for sale
    tadalafil for sale says:

    totally refrigerator [url=http://cialislet.com/#]cialis
    online generic[/url] honest sky fairly calm together buy cialis
    20mg usa exactly grandmother [url=http://cialissom.com/#]cialis 20mg pills[/url] rarely database recently act instead viagra cialis for sale significantly interest http://cialissom.com/

  2. additional hints
    additional hints says:

    I just want to say I’m new to blogging and site-building and honestly enjoyed your web blog. Almost certainly I’m planning to bookmark your blog post . You amazingly come with really good articles. Thanks a lot for sharing with us your blog site.

  3. Google
    Google says:

    I’m impressed, I must say. Seldom do I encounter a blog that’s both educative and interesting, and without a doubt, you have hit the nail on the head. The problem is something that too few men and women are speaking intelligently about. I’m very happy that I found this in my hunt for something relating to this.

  4. Google
    Google says:

    Your style is very unique in comparison to other people I’ve read stuff from. I appreciate you for posting when you’ve got the opportunity, Guess I will just bookmark this page.

  5. Google
    Google says:

    Everything is very open with a very clear clarification of the challenges. It was really informative. Your website is extremely helpful. Thanks for sharing!

  6. Judi Online Terpercaya
    Judi Online Terpercaya says:

    You’re so awesome! I don’t believe I have read anything like that before. So great to find another person with some original thoughts on this issue. Seriously.. thanks for starting this up. This web site is one thing that is required on the internet, someone with a little originality!

  7. Google Chrome 2020
    Google Chrome 2020 says:

    You are so awesome! I do not suppose I’ve read a single thing like that before. So good to find somebody with a few genuine thoughts on this subject. Really.. thank you for starting this up. This web site is one thing that is required on the web, someone with some originality!

  8. domino
    domino says:

    Nice post. I learn something new and challenging on sites I stumbleupon on a daily basis. It’s always helpful to read articles from other writers and use a little something from other sites.

  9. daily to do list template
    daily to do list template says:

    After exploring a handful of the articles on your website, I really like your way of blogging. I book marked it to my bookmark webpage list and will be checking back in the near future. Please visit my web site too and tell me your opinion.

  10. marketing
    marketing says:

    I seriously love your site.. Pleasant colors & theme. Did you develop this site yourself? Please reply back as I’m planning to create my own blog and want to find out where you got this from or exactly what the theme is called. Kudos.

  11. jual busur panah
    jual busur panah says:

    Can I simply say what a comfort to uncover somebody who genuinely knows what they’re discussing online. You certainly know how to bring an issue to light and make it important. A lot more people have to read this and understand this side of the story. It’s surprising you aren’t more popular since you definitely have the gift.

  12. pokeridn
    pokeridn says:

    Good post. I learn something new and challenging on websites I stumbleupon every day. It will always be useful to read through content from other authors and practice something from their sites.

  13. s1288.net
    s1288.net says:

    Right here is the perfect web site for anybody who hopes to understand this topic. You know so much its almost tough to argue with you (not that I actually would want to…HaHa). You definitely put a fresh spin on a topic that’s been discussed for a long time. Wonderful stuff, just wonderful!

  14. idnplay
    idnplay says:

    Having read this I thought it was rather enlightening. I appreciate you finding the time and effort to put this informative article together. I once again find myself spending way too much time both reading and commenting. But so what, it was still worthwhile!

  15. max poker 88
    max poker 88 says:

    Everything is very open with a very clear explanation of the challenges. It was definitely informative. Your site is extremely helpful. Many thanks for sharing!

  16. idn poker
    idn poker says:

    Everything is very open with a really clear description of the challenges. It was definitely informative. Your site is extremely helpful. Thank you for sharing!

  17. judi ayam online 24 jam
    judi ayam online 24 jam says:

    I’m impressed, I must say. Seldom do I encounter a blog that’s both educative and interesting, and let me tell you, you have hit the nail on the head. The problem is something that not enough men and women are speaking intelligently about. I’m very happy I came across this in my hunt for something concerning this.

  18. s128
    s128 says:

    Hi, I do think this is an excellent blog. I stumbledupon it 😉 I am going to return yet again since i have book-marked it. Money and freedom is the best way to change, may you be rich and continue to guide others.

  19. s128
    s128 says:

    An outstanding share! I have just forwarded this onto a friend who was conducting a little research on this. And he actually bought me dinner simply because I stumbled upon it for him… lol. So allow me to reword this…. Thanks for the meal!! But yeah, thanks for spending some time to talk about this issue here on your site.

  20. DominoQQ Online
    DominoQQ Online says:

    I’m pretty pleased to uncover this great site. I want to to thank you for ones time for this fantastic read!! I definitely savored every bit of it and I have you saved to fav to see new information on your blog.

  21. maxpoker88
    maxpoker88 says:

    I’m pretty pleased to uncover this web site. I need to to thank you for ones time for this wonderful read!! I definitely loved every bit of it and i also have you saved to fav to see new stuff on your web site.

  22. ratu poker 88
    ratu poker 88 says:

    Oh my goodness! Awesome article dude! Many thanks, However I am having problems with your RSS. I don’t understand the reason why I am unable to subscribe to it. Is there anybody else getting the same RSS issues? Anyone that knows the answer can you kindly respond? Thanx!!

  23. ind poker
    ind poker says:

    This is a good tip especially to those new to the blogosphere. Simple but very precise info… Thanks for sharing this one. A must read post!

  24. pkv poker
    pkv poker says:

    Howdy! I could have sworn I’ve been to this website before but after browsing through some of the posts I realized it’s new to me. Regardless, I’m definitely pleased I stumbled upon it and I’ll be bookmarking it and checking back frequently!

  25. situs togel terpercaya
    situs togel terpercaya says:

    I blog frequently and I seriously thank you for your content. Your article has truly peaked my interest. I’m going to take a note of your website and keep checking for new details about once per week. I subscribed to your RSS feed as well.

  26. togel online
    togel online says:

    Hello there! This post could not be written any better! Looking at this article reminds me of my previous roommate! He continually kept talking about this. I most certainly will send this article to him. Pretty sure he will have a very good read. Thanks for sharing!

  27. agen4d
    agen4d says:

    Hello there! This post could not be written any better! Looking through this article reminds me of my previous roommate! He constantly kept preaching about this. I most certainly will send this article to him. Fairly certain he’ll have a good read. Thank you for sharing!

  28. kings128
    kings128 says:

    Hello, I do believe your site could be having web browser compatibility issues. Whenever I look at your blog in Safari, it looks fine however, if opening in Internet Explorer, it’s got some overlapping issues. I simply wanted to provide you with a quick heads up! Besides that, excellent blog!

  29. w11bet
    w11bet says:

    This is a very good tip especially to those fresh to the blogosphere. Brief but very accurate information… Thank you for sharing this one. A must read article!

  30. s12888
    s12888 says:

    I seriously love your site.. Great colors & theme. Did you build this web site yourself? Please reply back as I’m trying to create my own personal website and would like to find out where you got this from or just what the theme is called. Cheers!

  31. vivoslot
    vivoslot says:

    Your style is very unique in comparison to other folks I’ve read stuff from. I appreciate you for posting when you have the opportunity, Guess I will just book mark this site.

  32. jokerwin123
    jokerwin123 says:

    Hello there! I just want to give you a big thumbs up for your excellent info you have right here on this post. I will be returning to your site for more soon.

  33. vivoslot.net
    vivoslot.net says:

    Aw, this was a really nice post. Finding the time and actual effort to produce a great article… but what can I say… I put things off a whole lot and never manage to get anything done.

  34. John Deere Service Manuals
    John Deere Service Manuals says:

    This could be the ideal blog page for anybody who wants to learn about this theme. You recognize so much its nearly hard to argue with you (not that I really would want…HaHa). You definitely set a new spin on the subject matter thats been written about for years. Wonderful things, just wonderful!

  35. joker388.net
    joker388.net says:

    Can I simply just say what a relief to uncover an individual who really understands what they’re discussing on the web. You actually understand how to bring a problem to light and make it important. More people ought to check this out and understand this side of the story. I was surprised that you aren’t more popular since you certainly possess the gift.

  36. idpropkvgames
    idpropkvgames says:

    Hello there! I just wish to offer you a big thumbs up for the great info you’ve got right here on this post. I’ll be coming back to your web site for more soon.

  37. joker 123
    joker 123 says:

    Hi, I do believe this is a great web site. I stumbledupon it 😉 I may come back yet again since i have book marked it. Money and freedom is the best way to change, may you be rich and continue to guide other people.

  38. mastah android
    mastah android says:

    Next time I read a blog, Hopefully it doesn’t disappoint me as much as this particular one. I mean, Yes, it was my choice to read through, however I actually believed you would have something helpful to talk about. All I hear is a bunch of complaining about something you could fix if you were not too busy looking for attention.

  39. s128
    s128 says:

    Good web site you have here.. It’s hard to find quality writing like yours nowadays. I honestly appreciate people like you! Take care!!

  40. s1281
    s1281 says:

    Right here is the right website for anyone who wishes to find out about this topic. You know a whole lot its almost tough to argue with you (not that I actually would want to…HaHa). You certainly put a brand new spin on a topic that has been discussed for decades. Excellent stuff, just excellent!

  41. s1288
    s1288 says:

    Howdy, There’s no doubt that your site may be having browser compatibility problems. When I look at your web site in Safari, it looks fine however when opening in IE, it has some overlapping issues. I merely wanted to provide you with a quick heads up! Besides that, wonderful site!

  42. bandarqq
    bandarqq says:

    Can I just say what a comfort to find somebody who truly knows what they are talking about on the internet. You certainly know how to bring an issue to light and make it important. A lot more people must check this out and understand this side of your story. I was surprised that you aren’t more popular since you most certainly have the gift.

  43. dinasti4d
    dinasti4d says:

    After I originally left a comment I seem to have clicked on the -Notify me when new comments are added- checkbox and now every time a comment is added I get four emails with the exact same comment. Perhaps there is an easy method you can remove me from that service? Appreciate it!

  44. artipoker
    artipoker says:

    After going over a few of the articles on your web page, I seriously appreciate your technique of writing a blog. I saved it to my bookmark website list and will be checking back soon. Please visit my web site as well and tell me what you think.

  45. joker123 slot
    joker123 slot says:

    Greetings! Very useful advice in this particular article! It’s the little changes which will make the most significant changes. Thanks a lot for sharing!

  46. download sv388 apk
    download sv388 apk says:

    Can I simply just say what a comfort to discover someone that actually knows what they’re discussing online. You certainly realize how to bring an issue to light and make it important. More and more people should look at this and understand this side of your story. It’s surprising you aren’t more popular since you most certainly possess the gift.

  47. judionline.live
    judionline.live says:

    Hello! I could have sworn I’ve been to your blog before but after going through many of the articles I realized it’s new to me. Nonetheless, I’m definitely pleased I came across it and I’ll be book-marking it and checking back frequently!

  48. link alternatif s128
    link alternatif s128 says:

    This is the perfect blog for anyone who would like to find out about this topic. You understand so much its almost hard to argue with you (not that I personally would want to…HaHa). You definitely put a fresh spin on a topic which has been discussed for decades. Excellent stuff, just great!

  49. joker 123 apk
    joker 123 apk says:

    Aw, this was an extremely nice post. Finding the time and actual effort to create a really good article… but what can I say… I procrastinate a lot and don’t manage to get anything done.

  50. joker 123
    joker 123 says:

    Good blog you’ve got here.. It’s hard to find good quality writing like yours nowadays. I truly appreciate people like you! Take care!!

  51. login joker123
    login joker123 says:

    Oh my goodness! Awesome article dude! Thank you, However I am having troubles with your RSS. I don’t understand the reason why I cannot subscribe to it. Is there anybody else getting similar RSS problems? Anybody who knows the answer can you kindly respond? Thanks!!

  52. download idnpoker
    download idnpoker says:

    Having read this I thought it was very informative. I appreciate you finding the time and energy to put this informative article together. I once again find myself spending way too much time both reading and commenting. But so what, it was still worth it!

  53. sbobet login
    sbobet login says:

    I wanted to thank you for this excellent read!! I definitely enjoyed every little bit of it. I have got you bookmarked to check out new things you post…

  54. login sbobet
    login sbobet says:

    Having read this I thought it was very informative. I appreciate you spending some time and effort to put this content together. I once again find myself spending way too much time both reading and commenting. But so what, it was still worthwhile!

  55. indpoker
    indpoker says:

    Hello there! This blog post could not be written any better! Reading through this post reminds me of my previous roommate! He continually kept preaching about this. I will forward this information to him. Pretty sure he’ll have a great read. Thank you for sharing!

  56. idnpoker login
    idnpoker login says:

    Can I simply say what a comfort to uncover somebody who really understands what they are talking about on the web. You definitely understand how to bring a problem to light and make it important. More people have to look at this and understand this side of your story. I can’t believe you are not more popular since you surely possess the gift.

  57. situs slot
    situs slot says:

    Right here is the perfect webpage for everyone who really wants to find out about this topic. You understand so much its almost tough to argue with you (not that I personally will need to…HaHa). You certainly put a fresh spin on a subject that’s been discussed for a long time. Wonderful stuff, just great!

  58. pkv online
    pkv online says:

    I truly love your site.. Pleasant colors & theme. Did you build this website yourself? Please reply back as I’m looking to create my very own site and want to learn where you got this from or what the theme is called. Thanks!

  59. info togel
    info togel says:

    Hi! I just would like to offer you a big thumbs up for your excellent info you’ve got here on this post. I’ll be returning to your website for more soon.

  60. keluaran hk
    keluaran hk says:

    Aw, this was an incredibly nice post. Taking the time and actual effort to create a really good article… but what can I say… I procrastinate a lot and don’t seem to get anything done.

  61. prediksi sgp
    prediksi sgp says:

    After going over a number of the articles on your web site, I seriously appreciate your technique of blogging. I added it to my bookmark website list and will be checking back soon. Please visit my website as well and let me know your opinion.

  62. rantaiqq
    rantaiqq says:

    You are so interesting! I don’t suppose I have read something like that before. So wonderful to find somebody with original thoughts on this topic. Really.. many thanks for starting this up. This site is one thing that’s needed on the web, someone with a bit of originality!

  63. elangqq
    elangqq says:

    I truly love your website.. Excellent colors & theme. Did you build this amazing site yourself? Please reply back as I’m hoping to create my very own site and would love to know where you got this from or what the theme is named. Kudos!

  64. link alternatif bundapoker
    link alternatif bundapoker says:

    Can I simply just say what a comfort to find an individual who genuinely understands what they are talking about online. You actually know how to bring a problem to light and make it important. More people ought to look at this and understand this side of the story. I was surprised that you’re not more popular because you most certainly have the gift.

  65. aslidomino
    aslidomino says:

    This is the perfect site for everyone who would like to understand this topic. You know a whole lot its almost tough to argue with you (not that I actually will need to…HaHa). You certainly put a brand new spin on a topic that has been discussed for decades. Excellent stuff, just wonderful!

  66. idnpoker99
    idnpoker99 says:

    Aw, this was a really nice post. Taking the time and actual effort to generate a top notch article… but what can I say… I put things off a lot and never seem to get anything done.

  67. daftar wedeqq
    daftar wedeqq says:

    After exploring a few of the blog posts on your web page, I seriously appreciate your technique of blogging. I book marked it to my bookmark site list and will be checking back soon. Take a look at my web site as well and tell me your opinion.

  68. download poker idn
    download poker idn says:

    An interesting discussion is definitely worth comment. There’s no doubt that that you should publish more about this topic, it may not be a taboo matter but typically folks don’t discuss such issues. To the next! All the best!!

  69. aplikasi idn poker
    aplikasi idn poker says:

    An outstanding share! I’ve just forwarded this onto a co-worker who had been doing a little research on this. And he actually bought me lunch simply because I discovered it for him… lol. So allow me to reword this…. Thank YOU for the meal!! But yeah, thanx for spending time to talk about this topic here on your site.

  70. daftar poker idn
    daftar poker idn says:

    Good post. I learn something new and challenging on websites I stumbleupon everyday. It will always be interesting to read articles from other authors and practice something from their websites.

  71. idn poker 88
    idn poker 88 says:

    Next time I read a blog, I hope that it does not disappoint me as much as this one. I mean, I know it was my choice to read, however I truly thought you’d have something helpful to talk about. All I hear is a bunch of crying about something you could fix if you weren’t too busy seeking attention.

  72. John Deere Repair Manuals
    John Deere Repair Manuals says:

    Appreciably, this amazing blog is usually the nicest using this visible question. Naturally i harmonise with all your a conclusion but will thirstily wait for your entire one way up-dates. Stating thanks much will not only possibly be necessary, for ones dramatic quality with your coming up with. I could easily pick up your main rss to stay in advised from a improvements. Excellent hard work and far accomplishment of your home business deals! Please justify my personal substandard British free of cost . absolutely not items to start with language.

  73. link alternatif saranapoker
    link alternatif saranapoker says:

    Can I simply just say what a relief to find somebody that genuinely understands what they’re discussing over the internet. You certainly realize how to bring a problem to light and make it important. More people really need to read this and understand this side of the story. I was surprised you are not more popular because you surely have the gift.

  74. idn poker 88
    idn poker 88 says:

    When I originally commented I seem to have clicked the -Notify me when new comments are added- checkbox and now each time a comment is added I get four emails with the same comment. Is there an easy method you can remove me from that service? Cheers!

  75. website ini
    website ini says:

    I was extremely pleased to uncover this web site. I want to to thank you for your time just for this wonderful read!! I definitely really liked every bit of it and i also have you saved as a favorite to see new information in your website.

  76. maxtube
    maxtube says:

    Spot on with this write-up, I truly think this website needs a great deal more attention. I’ll probably be returning to see more, thanks for the info!

  77. cara analisa forex
    cara analisa forex says:

    You’re so cool! I don’t suppose I have read through a single thing like that before. So nice to find someone with a few original thoughts on this issue. Seriously.. thanks for starting this up. This web site is one thing that is required on the web, someone with some originality!

  78. Garnet
    Garnet says:

    Greetings! Very helpful advice within this post! It is the little changes that produce the most significant changes. Thanks a lot for sharing!

  79. bare
    bare says:

    I blog frequently and I seriously thank you for your content. The article has really peaked my interest. I will take a note of your website and keep checking for new information about once per week. I opted in for your Feed too.

  80. dingdong 24d live
    dingdong 24d live says:

    I’m impressed, I must say. Seldom do I encounter a blog that’s both equally educative and interesting, and let me tell you, you’ve hit the nail on the head. The problem is something which too few people are speaking intelligently about. Now i’m very happy that I came across this during my hunt for something regarding this.

  81. situs judi online
    situs judi online says:

    An impressive share! I’ve just forwarded this onto a friend who had been conducting a little homework on this. And he in fact ordered me lunch because I stumbled upon it for him… lol. So let me reword this…. Thanks for the meal!! But yeah, thanks for spending some time to talk about this issue here on your website.

  82. domino
    domino says:

    You’ve made some good points there. I checked on the web to learn more about the issue and found most people will go along with your views on this website.

  83. cara download idn poker iphone
    cara download idn poker iphone says:

    An intriguing discussion is worth comment. There’s no doubt that that you need to write more about this subject, it might not be a taboo subject but typically people don’t talk about these topics. To the next! Cheers!!

  84. Anime Wallpaper Terbaru
    Anime Wallpaper Terbaru says:

    You are so interesting! I don’t suppose I’ve truly read something like that before. So nice to discover somebody with a few unique thoughts on this subject matter. Really.. many thanks for starting this up. This web site is something that is required on the web, someone with some originality!

  85. dingdongtogel.com
    dingdongtogel.com says:

    Your style is very unique in comparison to other folks I’ve read stuff from. Many thanks for posting when you have the opportunity, Guess I’ll just bookmark this web site.

  86. bare
    bare says:

    Howdy! I simply wish to offer you a huge thumbs up for your great info you’ve got here on this post. I will be coming back to your web site for more soon.

  87. dingdong 48d live
    dingdong 48d live says:

    Hi there! I could have sworn I’ve visited this blog before but after looking at many of the articles I realized it’s new to me. Regardless, I’m certainly delighted I discovered it and I’ll be book-marking it and checking back regularly!

  88. dingdong daftar
    dingdong daftar says:

    After checking out a few of the blog articles on your site, I truly appreciate your way of blogging. I saved as a favorite it to my bookmark site list and will be checking back soon. Please check out my website as well and let me know what you think.

  89. pembuatan taman jakarta
    pembuatan taman jakarta says:

    When I originally left a comment I seem to have clicked on the -Notify me when new comments are added- checkbox and from now on each time a comment is added I receive 4 emails with the same comment. There has to be an easy method you are able to remove me from that service? Appreciate it!

  90. togel online
    togel online says:

    Hi there! This post could not be written much better! Going through this post reminds me of my previous roommate! He constantly kept talking about this. I’ll forward this information to him. Fairly certain he’ll have a very good read. Thanks for sharing!

  91. jasa taman
    jasa taman says:

    Aw, this was an extremely nice post. Spending some time and actual effort to generate a great article… but what can I say… I procrastinate a lot and don’t manage to get anything done.

  92. download aplikasi slot joker123
    download aplikasi slot joker123 says:

    An interesting discussion is definitely worth comment. I do think that you need to publish more about this issue, it may not be a taboo subject but generally people don’t speak about these topics. To the next! Kind regards!!

  93. joker123 apk
    joker123 apk says:

    I’m extremely pleased to discover this web site. I want to to thank you for ones time due to this wonderful read!! I definitely savored every part of it and i also have you book-marked to look at new things in your website.

  94. joker123 ios
    joker123 ios says:

    Oh my goodness! Incredible article dude! Thanks, However I am going through issues with your RSS. I don’t know the reason why I cannot join it. Is there anybody else getting identical RSS issues? Anyone that knows the answer will you kindly respond? Thanks!!

  95. download joker123 apk
    download joker123 apk says:

    This is the right web site for everyone who wants to find out about this topic. You understand so much its almost tough to argue with you (not that I actually will need to…HaHa). You certainly put a fresh spin on a topic that has been discussed for decades. Great stuff, just great!

  96. bare
    bare says:

    Hi, I do think this is a great website. I stumbledupon it 😉 I will revisit yet again since i have bookmarked it. Money and freedom is the greatest way to change, may you be rich and continue to guide others.

  97. seragam net tv lengan panjang
    seragam net tv lengan panjang says:

    An impressive share! I’ve just forwarded this onto a colleague who has been doing a little research on this. And he in fact ordered me lunch because I discovered it for him… lol. So allow me to reword this…. Thanks for the meal!! But yeah, thanx for spending time to talk about this topic here on your web site.