C Programming Tutorial – 43 – Dereference Pointer

dereferencing pointer to incomplete type
This is a topic that many people are looking for. https://granthamandira.org/ is a channel providing useful information about learning, life, digital marketing and online courses …. it will help you have an overview and solid multi-faceted knowledge . Today, https://granthamandira.org/ would like to introduce to you C Programming Tutorial – 43 – Dereference Pointer. Following along are instructions in the video below:

alright guys now that we understand exactly what pointer is Im going to go ahead and show you a cool trick that you can do with pointers and this program right here is the same exact thing I just deleted some extra lines and move some things around but its the same thing I taught you guys in last Sorrell what I did in this line is make a variable then I made a pointer and then I printed out the variables information and then the pointers information so again like I said I just cleaned it up a little bit because the last program was kind of messy but all that stuff right there so what I wanted to teach you in this tutorial is how to dereference a pointer essentially its actually probably easier if I just uh print it out and show you guys because you know just me trying to talk talk to you about

memory addresses youre like what so make a print statement and then type this code so actually let me stick this in between two new lines so right here what I want to do is press ampersand P tuna and thats just literally going to print out this right here and after this put a colon and press % D now that % D value is what Im trying to display in this tutorial so again the new thing that Im going to be printing out is this right here ampersand P tuna and as you can see whenever I print this out it prints out the value of 19 pretty weird so what ampersand does whenever you add this special symbol before the pointer variables name is its called D referencing a pointer now what it does is it essentially says okay you want me to dereference p tuna so Im going to go to the variable that

Im pointing to which is this right here tuna or this is the address and get the value of it so again whenever you dereference a variable it goes to the variable that appoints to and it gets the value of it so if this ampersand P tuna is equal to 19 does that mean this that ampersand P tuna that equals 19 and also the regular tuna variable up here we also saw that that equals 19 does that mean that this is essentially the same thing is this well indeed yes it does so these are pretty much two different ways that we can access the value of the variable we can dereference its pointer and access it and we can also just use the regular variable name and access it so with this new information that we learned lets set this equal to a new value 71 and print it out again copy print this out

and we can actually just print out tuna doesnt even matter so tuna tuna let me run this and check it out so this was all the old stuff and this is when we just printed it out the first time which I showed you guys and last time we ran this and then after this we took ampersand so I forgot to get rid of this we took ampersand P tuna which essentially dereferenced it and set it equal to 71 so thats why this ampersand P tuna which is dereferencing the variable and tuna are both now equal to 71 so again probably Im going to delete this line before I post the source code on my forum but again the one last thing you have to take away from this tutorial is you can use this special ampersand sign to dereference a pointer why they named it dereference I dont know they just want to be

but what the references a pointer means is basically go to that variable and get the value of it so you can either get the value of variable this way be it by dereferencing a pointer or just using the old-fashioned way which is using the variables name so if we can just use the variables name like before why wouldnt we just always do that why we need to do this new special dumb symbol well in the next tutorial Im going to be showing you guys something cool about arrays and after that Im going to shown you guys how you can actually dereference pointers and do something useful with them other than just putting gram knowledge in your brain so for now thank you guys for watching if you have any questions ask me on my forum and well stick around and you guys are going to see whats up with these cool things see you later

language, for, beginners, youtube, thenewboston, lesson, bucky, tutorial, lectures, arrays, functions, pointers, structures, bangla, roberts, how, to, learn,…
Thank you for watching all the articles on the topic C Programming Tutorial – 43 – Dereference Pointer. All shares of https://granthamandira.org/ are very good. We hope you are satisfied with the article. For any questions, please leave a comment below. Hopefully you guys support our website even more.

Leave a Comment