C Programming Tutorial - 42 - Pointers

Поділитися
Вставка
  • Опубліковано 20 січ 2025

КОМЕНТАРІ • 224

  • @simonlevien3745
    @simonlevien3745 8 років тому +130

    I came here because goddamn Harvard's CS50 can't explain this, thank you so much

    • @rafaelnavarrocanizarescorr7057
      @rafaelnavarrocanizarescorr7057 5 років тому +6

      I think they fixed it... I'm taking the course now and besides the main lecture, they have short videos explaining things just like these. Actually they have a few videos just about pointers. Sorry you didn't have access to that.

  • @vishal3725
    @vishal3725 7 років тому +94

    18 dislikes? why? .. This video explained me more in 10 mins then my professor could in 10 weeks.. jeez (y) keep up the good work man..

    • @rakdos5371
      @rakdos5371 6 років тому +26

      Apparently those ppl don't like tuna

    • @kimleng3846
      @kimleng3846 5 років тому +1

      Maybe because his code is too small? Idk, I have trouble with it at first but I'm fine with it now

    • @Neb_Explains
      @Neb_Explains Рік тому

      the dislikes are from professors who have some skill issues in teaching

  • @Sami-hm9kq
    @Sami-hm9kq 9 років тому +74

    I don't know why so many people are complaining. If you watch these videos in 1080p and in FULLSCREEN , you would see everything just fine .

    •  9 років тому +25

      3rd world problems, can't run at 1080p . Broadband ;_;

    • @amrfarag8308
      @amrfarag8308 9 років тому +2

      San Dé i have slow internet i use 360 or 480 max but these ones i can watch on 720 1.25 speed with no prob.

    • @vijayendranvijay457
      @vijayendranvijay457 9 років тому +8

      Sami Rehmann We could do that, but then we wouldn't be able to have our own Code::Blocks window beside the video to work alongside him or type down any notes (unless we had a second monitor). And his videos show the entire view of his desktop, most of which is unnecessary, it'd be better if he just zoom into the code space which actually is the only important part of the screen.

    • @fuat8101
      @fuat8101 9 років тому +1

      +Don't look for me Not really the greatest tip, but if you want to have Code Blocks and this video side-by-side, enlarge the video(not fullscreen) and then zoom in the website using ctrl+mouse scroll up. This should make it easier to work with both the browser and code blocks side-by-side without squinting your eyes.

    • @johnk230
      @johnk230 9 років тому +1

      +Sami Rehmann actually my problem was that I was wearing sunglasses inside, took them off. . . Perfect!

  • @shayne233
    @shayne233 9 років тому +91

    9:31, "so the last thing I want to POINT out is"

    • @nenume00
      @nenume00 6 років тому +1

      this motivated me even more to watch it

  • @shawnerz98
    @shawnerz98 5 років тому +3

    I've been a C novice for, like, 20 years. This is helping me to finally understand pointers. I really liked this an your Git course. Thanks!

    • @milkyway9225
      @milkyway9225 2 роки тому

      maybe you should consider different career, bcs it took you 19years longer to understand beginners concepts. Epic. Oh, btw, video isn't accurate so good luck figuring out language basics

  • @il2xbox
    @il2xbox 8 років тому +105

    This was a good video.
    (puts on sunglasses)
    You've definitely given me a few pointers.
    YEAAAAAAAAAAAAAHHHHHHHHHHHHHHHHHHHHHHHHHH!

  • @tdsimpson
    @tdsimpson 8 років тому +47

    I named my cat Bucky because they both love tuna equally.

  • @FlyingNimbus3FTW
    @FlyingNimbus3FTW 9 років тому

    Very helpful summary, clearly explains the basics of pointers by using approachable language and examples. It was refreshing to have someone begin from the lowest level possible and moving up to the more complex uses, unlike most videos and web articles. The format also makes it very easy to follow along and actually code a lot of this yourself as he leads on the video. Great video for someone looking for more information on the basics of pointers.

  • @JaskaranSingh-tf5of
    @JaskaranSingh-tf5of 6 років тому

    You're the best. I got nothing else to say. Your explanations are simple, to the point and covers all the other respective details about the topic too.
    My teacher worked so hard to explain it in two weeks, just made us - (students) more confused. Thanks a lot I learnt about pointers here than in my class.

  • @likelybased
    @likelybased 6 років тому

    this is the clearest explanation of pointers that I have seen. Professors need to show this video

  • @seasnek7024
    @seasnek7024 4 роки тому

    Bro why can I find free, simple and easy tutorials on UA-cam but my actual lecturers and tutors can’t do any of that! Bravo!

  • @justinhowe776
    @justinhowe776 9 років тому

    Great description, I know I found this topic to be difficult when I started learning C and many of my classmates still struggle with this topic sometimes. Using a simple analogy such as the house with an address example really helped me to get my head around this topic when I first learned it. I feel like I initially suffered due to the mentality of just moving the syntax around until it compiled/worked without fully understanding it. Starting at such a basic level then moving to syntax, then examples really helped me learn this topic. Thanks for the video!

  • @DenisBencic
    @DenisBencic 7 років тому

    Pointers are so confusing concept that I had to watch tutorials 42 and 43 (which were way more informative than the lectures by the way) at least twice. I love how your tutorials are so consistent to the things we discussed on my lectures.

  • @fortytwo6257
    @fortytwo6257 9 років тому +16

    very helpful, thank you so much! trying to study for a final

  • @PritiSingh-zf2bn
    @PritiSingh-zf2bn 4 роки тому

    Bucky you are just greatest teacher, every teacher should like you. You make such a difficult thing the simplest

  • @matthewwood8575
    @matthewwood8575 9 років тому

    just saved me for my finals. starting at the basics and working through them simply has made it easier for me to refresh my knowledge and apply it practically

  • @endod8708
    @endod8708 8 років тому +149

    final exam after 7 hours trying to finish the whole tutorial which is 6 hours long hhhhhhh

    • @vuongvincent
      @vuongvincent 8 років тому +1

      wut

    • @endod8708
      @endod8708 8 років тому +8

      ***** it went well :)

    • @vuongvincent
      @vuongvincent 8 років тому +5

      Amen I'm in the same boat now. Final Exam on Monday - 5 chapters to catch up on...

    • @endod8708
      @endod8708 8 років тому +1

      Vincent Vuong hahah good luck bro, u can do it :)

    • @katsaras1
      @katsaras1 7 років тому +12

      You will make it if you are an engineer :p

  • @dhirajbandi1530
    @dhirajbandi1530 5 років тому +2

    I really love your work.... I just wanted to say thanks, you're a great teacher.

  • @yingtang9073
    @yingtang9073 7 років тому +3

    I have a question. checkout the address in 3 timelines:
    4:19------0028FFIC
    7:15-----0028FF18
    0028FF18
    8:08-----0028FFIC
    0028FFIC
    0028FF18
    My question is why the pointer of tuna changed the second time, and at the third time it changed back. really confusing.

    • @Gobberfisch
      @Gobberfisch 7 років тому +1

      4:19 : 0028FF1C (hexadecimal) = 2686748 (decimal number)
      7:15 : 0028FF18 (hexadecimal) = 2686744 (decimal number)
      As you can see the number has decreased by the value of 4.
      to be correct it has decreased by 4 Bytes (every computer adress can store one byte)
      He stored an integer, integers are 32 bit = 4 bytes.
      because the first adress (2686748) was already used after he used it at 4:19 , C searched for the next free 4 bytes to store the integer.
      In that case it was 2686748 - 4 = 2686744 (second adress).
      But I dont know why it decreased, I just learned this stuff this semester.

  • @ohaRega
    @ohaRega 7 років тому

    Great video, but a small little note for some viewers:
    The memory address *is* a number. It is a hexadecimal (base 16) number. In fact this is important, because we do arithmetic operations on them. Add 1 to the address, and whoop, you are at the next byte in your memory, and so on.

    • @CodeVault
      @CodeVault 6 років тому

      The problem is pointer arithmetic is done at the level of the sizeof the type it is pointing to. +1 to an address from an int pointer would be +4 on the number.
      I like to think of them as some special sort of numbers since you can't add/multiply/divide two addresses, subtraction result is divided by the size and whatnot.

  • @tobiasfeil1993
    @tobiasfeil1993 9 років тому +1

    wow, I read a book about C that explained a lot about pointers but it never actually told me that it's just a variable for an address. Or maybe I just don't remember that haha. That explains it so well, thanks!

  • @bibekster8910
    @bibekster8910 7 років тому +2

    what a crystal clear explanation! well done sir

  • @akaBPhife
    @akaBPhife 6 років тому

    Bravo Bucky what you explained in less than 10 mins.. what my instructor could not in hours if not days! lol THANKS Bucky!

  • @yingtang9073
    @yingtang9073 7 років тому +5

    a pointer is a special type of variable that can hold the memory address of a variable.

  • @JD-hq1kn
    @JD-hq1kn 6 років тому

    Your tutorials are awesome... Short and informative in the simplest possible way.. Thanks man... Just a request , please make the font size bigger next time you make any tutorial series on programming.. :)

  • @ngplradhika
    @ngplradhika 9 років тому +2

    Another way to print the address of a variable : (used in some books) is by using
    %u instead of %p
    check this code out :
    #include
    #include
    int main()
    {
    int tuna=4;
    printf(" %p \t %u", &tuna, &tuna);
    return 0;
    }

    • @yarishrajdev9186
      @yarishrajdev9186 7 років тому

      It seems that "%p" prints out the memory address in hex form, while "%u" prints out the memory address in decimal form

    • @yingtang9073
      @yingtang9073 7 років тому

      both %p and %u stand for pointers?

    • @ajay000003
      @ajay000003 7 років тому

      no %u is for unsigned integer data types. they are not same thing.

  • @panaos54
    @panaos54 6 років тому

    thank you so much you have dave my life i lost one class about pointer and now i'm okay you are the best

  • @muhammadrafay4743
    @muhammadrafay4743 6 років тому

    Your videos deserve more views than others at least you build my concept of programming.

  • @KimBoKastekniv47
    @KimBoKastekniv47 10 років тому

    Thanks man, you make this complicated topic really easy to understand.

  • @nicklejeune3095
    @nicklejeune3095 6 років тому

    Thank you so much for un-confusing me. Trying to learn C on my own and avoid "bad habits".

  • @sebastianramadan8393
    @sebastianramadan8393 10 років тому +11

    Note to viewers: Like %s expects a char *, %p expects a void *, NOT an int *. While his code may work on some systems, there are others it will crash on. You need to cast the int * to a void * first, eg: printf("%p
    ", (void *) &tuna);

    • @larsadb
      @larsadb 9 років тому +2

      Sebastian Ramadan it would crash if you wrote it like he did but without the "&", if you wrote it like this: printf("%p
      ", tuna); your compiler would ask if you meant a void instead of an int

    • @sebastianramadan8393
      @sebastianramadan8393 9 років тому

      Lars Db It's invalid to suggest that invoking undefined behaviour definitively results in crashes; in many real life scenarios it doesn't... for example signed integer overflow, occasionally small buffer overflows and misaligned accesses on x86 will often "work" rather than "crashing". In fact, what you mentioned is another example that won't typically cause immediate crashes (though it may later on down the track, such is the nature of undefined behaviour)... See: ideone.com/gQ3CPh. *If you say that the behaviour results in a crash, then it is no longer undefined behaviour; it's behaviour that's defined to cause crashes*. What crashes on your system might "work correctly" (whatever that means, considering the nature of undefined behaviour) on my system... Do you understand? It's important to note that C won't necessarily save you by providing a nice clean crash for you to debug every time you do something wrong.

    • @larsadb
      @larsadb 9 років тому

      Sebastian Ramadan I guess you're right, well it did show plenty of error messages and finally crashed, I guess it was my software.

    • @sebastianramadan8393
      @sebastianramadan8393 9 років тому +1

      Lars Db Now that you know this information, it should be easy enough to find a teacher who knows C and can teach you. Questions such as "Why don't all undefined behaviours cause crashes?" should illuminate the gold from the grit. Best of luck to you :)

    • @sebastianramadan8393
      @sebastianramadan8393 9 років тому

      Lars Db ... and in the meantime, don't forget to ensure arguments corresponding to a %p directive are void *... and say g'day to the Linguist Llama for me :)

  • @muhammadrafay4743
    @muhammadrafay4743 6 років тому

    Final exam on 3rd January and I'm practicing whole tutorials best teacher in programming.

  • @ruchithr15
    @ruchithr15 4 роки тому

    appreciate it my brother, you are goated for this

  • @IlloDaGreek
    @IlloDaGreek 6 років тому +1

    If you are printing out the pTuna's adress (8.45) why is it the same as its value? should'nt the adress to pTuna be another adress and not the same adress as tuna?

  • @Purplehaze778
    @Purplehaze778 10 років тому +34

    Bucky, it would be awesome if u could zoom ur screens like on the older videos using some screen capture softwares. I understand that it's a hell lot of jobs to do looking at the volumes of tutorials u are making everyday, but ppl like me who are trying to learn on the go on cell phones, it's way difficult. Thank you for ur awesome tutorials though.

    • @gollumei
      @gollumei 6 років тому +1

      You program on your phone?

    • @hetaeramancer
      @hetaeramancer 3 роки тому

      @@gollumei Well some of us do. And it's not that, it's really small and although you can read it, you have to put your face closer to the monitor.

  • @qarsak--7706
    @qarsak--7706 9 років тому

    I generally thank you for your all tutorial Mr

  • @thestarinthesky_
    @thestarinthesky_ 5 років тому

    Such an informative video. Please keep making more :)

  • @TheMarvpaul
    @TheMarvpaul 8 років тому

    Super cool tutorial. Explained step by step and easy to understand. Thanks for sharing this if us

  • @ko.pi.pe.
    @ko.pi.pe. 7 років тому +5

    I don't know why I'm watching this, but your claim that memory addresses cannot be stored as integers is completely wrong. ( 5:05 ) "It can't be an integer because it has characters in it." WTF? Memory addresses are typically represented as integers in hexadecimal notation, but can be represented as base 10 numbers or even base 2 numbers. A memory address is an integer, always, and its maximum size depends on the CPU architecture.

    • @vellaaatma4441
      @vellaaatma4441 6 років тому

      You enlightened all my doubts. Thanks man !!

  • @akshaypimpalkar7573
    @akshaypimpalkar7573 9 років тому +1

    when i ran program.. value in pointer should be the address of given variable...but it is showing wrong address...plz help me.

  • @elizavetawallace4356
    @elizavetawallace4356 8 років тому +1

    Thank you! You are amazing teacher!!!

  • @Dan79istheman
    @Dan79istheman 9 років тому

    Great Video, helped me heaps! Thanks.

  • @neeld517
    @neeld517 8 років тому +1

    man can you please expand your screen so that we can also see what are you typing and running ? The font is so tiny that I can hardly read :(

  • @charimuvilla8693
    @charimuvilla8693 4 роки тому

    Nice tutorial! Came here from cython not C but it is still very useful!

  • @iLikeSkittlesOG
    @iLikeSkittlesOG 9 років тому +5

    what if you had a pointer to pointer?

  • @samuelr879
    @samuelr879 4 роки тому +1

    "1 thing i want to point out"
    that pun

  • @s42s42s
    @s42s42s 8 років тому

    Really great explanation on pointers

  • @ovalwingnut
    @ovalwingnut 8 років тому

    "First time watcher". POINTERS: Now that's what I'm talking bout... GOOD STUFF, thank you. Clear & Concise = I'm hooked. Make room for another sUbScRiPtIoN. p.s. And it's in good old (audible) English too. Can't beat that :O) Cheers

  • @malcolmhollett8638
    @malcolmhollett8638 4 роки тому

    damn, that was some phenomenal explaining

  • @aaroncoe9046
    @aaroncoe9046 7 років тому

    Thank you so much for the clear explanation.

  • @danieldixon5944
    @danieldixon5944 5 років тому

    Hey Bucky. Can you make your fonts in your tutorials any smaller. Looks like the Tuna fish ran off with your larger fonts. Looks as though I need magnifying glass to view your tutorials. :-)

  • @calvinchristiano7119
    @calvinchristiano7119 4 роки тому

    so what will happen if we want to know where the computer saves our variable is and we dont use %p, but %d. i've tried, it shows a random numbers and i dont know what it is. plz reply this comment if u know about this

  • @ufotofu9
    @ufotofu9 5 років тому

    Is a pointer like the "new" keyword in Java? Creating a memory address to reference an Object?

  • @maleenjayasuriya7161
    @maleenjayasuriya7161 9 років тому

    Thanks man! You're pure awesome! :D

  • @marcoraguseo7313
    @marcoraguseo7313 9 років тому

    Great tutorial! What IDE did you use in this video?

    • @Know_Thyself_9
      @Know_Thyself_9 9 років тому +1

      Marco Raguseo he is using codeblocks

  • @manojkumarsubramaniam7122
    @manojkumarsubramaniam7122 8 років тому

    Thanks bro , This explained the pointer for me

  • @jellybean595
    @jellybean595 6 років тому

    So hey, I got this as my problem can you help me to solve this?
    main( ) function
    In the main( ) function, the program will:
     call a user defined function input( ) passing two pointers, namely previous_reading* and current_reading*
     Upon return of the input( ) function, main( ) will call for another user defined function named calculate( ).
     calculate( ) will take the difference of current_reading and previous_reading values (current_reading - previous_reading).
     The main( ) will then print on the screen the bill amount based on the returned value from calculate( ).
    how to return the input() function to main()? I dont get it.

  • @darkscorpionomega
    @darkscorpionomega 6 років тому

    So if I need to point to a typedef struct and the parameter of the function I have to call is int *var what would I do?

  • @szilagyipetihu
    @szilagyipetihu 6 років тому

    if only i could like this video for 5 million times

  • @sarthakairan6548
    @sarthakairan6548 7 років тому +2

    press windows button and then +
    it will zoom so you can see easily

  • @mariadoss2553
    @mariadoss2553 7 років тому

    what if i want to have this pointer in binary to encrypt a file on my computer using DES?

  • @Amy-ur6pi
    @Amy-ur6pi 5 років тому

    amazing tutorial! thank you so much

  • @mjsanchez2173
    @mjsanchez2173 7 років тому +1

    The characters are too small. I can't see the screen.

  • @CheatCodeSam
    @CheatCodeSam 7 років тому

    you explained this way better then cs50.

    • @osamagamal495
      @osamagamal495 7 років тому +1

      cs50 is way too complicated for beginners, they don't simplify anything, i remember one of the shorts video when Doug, was explaining the pass by value and by reference, I didn't understand shit!
      they intentionally make everything complicated.
      honestly it's not the ideal path for beginners.

  • @fernandosalas4885
    @fernandosalas4885 4 роки тому

    Best explanation ever!!

  • @leo-rq2ei
    @leo-rq2ei 9 років тому

    YAS i finally understand!
    thanks man

  • @aleksandrskutins3015
    @aleksandrskutins3015 6 років тому +3

    "We can't store memory address in int because it has characters in it" L0L

  • @valour549
    @valour549 6 років тому

    The weirdest thing is you don't even need the * before pTuna, and the code will still work identically. Someone explain?

  • @picuinhaXurumelas
    @picuinhaXurumelas 9 років тому

    I can just access addresses that I create in my program?Or I can access whatever I have in my computer?

    • @BrokenVaas
      @BrokenVaas 9 років тому +1

      +Guiango Thinoiras I think you can access anything. You just make code::blocks look at an address and it tells you what's in it.

  • @whateveryh2119
    @whateveryh2119 8 років тому +1

    This seems like good stuff. Too bad I can't see what he is doing with that font size.

  • @doodh_jalebi
    @doodh_jalebi 10 років тому +9

    It's really hard to understand what you're doing when you can't see it. Please zoom in on the code when you're writing it so we could get a better look at it. Other than that, Nobody explains it better than you do! :D

    • @pAirA_
      @pAirA_ 10 років тому +3

      You HAVE to watch it in HD, and you didn't need to on his earlier tutorials... Yeah I'm confused too lol

  • @satkarjain6401
    @satkarjain6401 6 років тому

    What does the address of memory address means.

  • @fzehra9515
    @fzehra9515 5 років тому

    can we convert &ptuna to a variable like int *pptuna = &*ptuna

  • @asjadsiddiqui7409
    @asjadsiddiqui7409 4 роки тому

    so would printf("%d", *&age_variable); work?

  • @ybleon7131
    @ybleon7131 7 років тому

    Great explanation!!!

  • @termiteterrorVSmyth
    @termiteterrorVSmyth 7 років тому

    thenewboston man you sure do like tuna

  • @surjakantasingh3377
    @surjakantasingh3377 6 років тому

    What is the point of pointer when we can go easy with array🤔🤔?

  • @abhilashpavan8436
    @abhilashpavan8436 8 років тому

    hi been workig on this tutorial for quit a while and saw this pointer video and got a doubt
    can any one menction the difference between the below two printf lines
    int a = 100;
    printf("%p",a);
    printf{"%p", &a);
    both show the different addresses
    so both are good to use or just have to use the second printf

    • @jakeeleazer2133
      @jakeeleazer2133 8 років тому +1

      The p flag tells C to display the output in hexadecimal. I think your first printf statement which contains the integer value 100 is put out as that same value but in hexadecimal format. It is not another address for the variable a but rather the number 100 converted from base 10 to base 16.
      Your second printf statement displays the actual memory address of the variable a.

    • @jakeeleazer2133
      @jakeeleazer2133 8 років тому

      So use second printf

    • @yingtang9073
      @yingtang9073 7 років тому

      not quite understand, can you explain a little bit more. thank you.
      is %p stand for pointer?

  • @gabixolaa
    @gabixolaa 8 років тому

    why theres a pTuna and then below &pTuna

  • @bluebird563
    @bluebird563 6 років тому +1

    scaling is too small on my 14" screen can't rread the code

  • @OmarAdel19
    @OmarAdel19 8 років тому

    What if want to get the address of the Pointer itself?

    • @beepst
      @beepst 7 років тому

      Omar Adel &pTuna

  • @nikitasingh2134
    @nikitasingh2134 4 роки тому

    so like message address is...,,. an address of an address? (figuratively speaking)

  • @colonelh.s.l.3834
    @colonelh.s.l.3834 2 роки тому

    So much better than my professor

  • @gauravmg
    @gauravmg 6 років тому

    eating Tuna will never be the same again.

  • @outerhaven6809
    @outerhaven6809 9 років тому

    From what kind of programs can be "pointers" will be useful?

    • @TomaszWota
      @TomaszWota 8 років тому

      They can be used for virtually anything, but you should only use them when you really need them - otherwise, when you can just use straight objects with standard containers - use that. When you can use references - use that.

  • @Diddy10443
    @Diddy10443 8 років тому

    Man you're the best

  • @hanyi8510
    @hanyi8510 6 років тому

    Guys can I ask that pointer is use for? Any example?

    • @CodeVault
      @CodeVault 6 років тому +1

      When you have, for example, a large array... think 2000 elements and want to pass that array to a function. Instead of passing the whole array (2000 elements * sizeof(element)) you simply pass a pointer to the start of the array. In fact, in C, there is no other way to pass an array to a function. The same goes for large data structure. Here's an example:
      typedef struct LargeStruct {
      // ... 2000 bytes of data
      } LargeStruct;
      void passWithoutPointer(LargeStruct struct) { //

  • @Masztufa
    @Masztufa 6 років тому

    techincally 0028FF1C is a number.
    It's a 32 bit integer.
    Just because it doesn't have 10 symbols to choose from (0,1,2,3,4,5,6,7,8,9) it can still be a number.
    Coming from a nitpicking math nerd learning programming

  • @Musa-lf5yn
    @Musa-lf5yn 8 років тому

    what program are u using??

  • @roadtrip5677
    @roadtrip5677 7 років тому

    what is the difference between * and **?

    • @CodeVault
      @CodeVault 6 років тому

      * is like telling the pointer to look at the address it is pointing and get that value.
      ** would basically do that twice. Look at address -> Get the value -> Look at that value as an address -> Get the value from that latter address

  • @ThilebanTheEngineer
    @ThilebanTheEngineer 6 років тому

    Not giving the correct output with online compiler or is there anything wrong in my code. If anyone can find a mistake in the code below pls let me know thanks.
    #include
    #include
    #include
    #include
    #include
    int main() {
    int coffee = 19;
    printf("Address \t Name \t Value
    ");
    printf("%p \t %s \t %d
    ", &coffee, "coffee", coffee);
    int * pCoffee = &coffee;
    printf("%p \t %s \t %d
    ", pCoffee, "coffee", coffee);
    printf("%p \t %s \t %d
    ", &pCoffee, "pCoffee", pCoffee);
    }

    • @CodeVault
      @CodeVault 6 років тому

      The problem is simple, this line:
      printf("%p \t %s \t %d
      ", &pCoffee, "pCoffee", pCoffee);
      should be changed to
      printf("%p \t %s \t %d
      ", pCoffee, "pCoffee", *pCoffee);
      pCoffee is already a pointer so you don't have to get the reference to it with '&' ('&pCoffee' would actually be a pointer to a pointer)
      Also, since 'pCoffee' is a pointer, simply giving that to printf would print out the actual address. You want to go to that address and get that value (that's what '*' is for).
      Hope this helped!

  • @bredmond812
    @bredmond812 6 років тому

    I am just learning programming, but it looks like pointer variables are similar to "PEEK" in the BASIC programming language.

  • @JozefPochyba
    @JozefPochyba 9 років тому

    Great tutorial

  • @lakinnisova459
    @lakinnisova459 5 років тому

    Explain how to use pointers in functions

  • @Naniy55462
    @Naniy55462 8 років тому

    Sorry but Iam not getting the Same result , as ptuna value is address of tuna ,but Iam getting some other value

    • @bubberD
      @bubberD 8 років тому

      manoj y it your taking about the memory location then it will be vary from person to person depending on how you have your computer setup

    • @Naniy55462
      @Naniy55462 8 років тому

      thank god i got it now ,instead of using %p i used %d
      printf("%p \t %s\t %p
      ",&ptuna,"ptuna",ptuna);
      thanks spiderman for helping hand

    • @ebrahimashraf5640
      @ebrahimashraf5640 6 років тому

      no, it's the same value but in decimal

  • @vgmda
    @vgmda 8 років тому

    really helpful thank you

  • @AttaullahShah
    @AttaullahShah 3 роки тому

    Screen size too small to be interesting.

  • @yatnbangad7893
    @yatnbangad7893 5 років тому

    Bucky Roberts bhaiya, tum bhagwaan ho!

  • @MasterQuestMaster
    @MasterQuestMaster 10 років тому +8

    I don't even know why I'm watching this. I know pointers and I don't even use C/C++ anymore.
    Maybe just because Bucky is awesome.

    • @Scootaloose
      @Scootaloose 10 років тому +2

      I use these to refresh my memory before classes start :P

    • @MasterQuestMaster
      @MasterQuestMaster 10 років тому

      ***** For what we did, I didn't need to refresh anything. I am more like the "Oh, we are going to learn it! Better learn everything beforehand!"

  • @ianiket0013
    @ianiket0013 9 років тому

    Thank you Bucky........