C_72 Pointers in C- part 2 |Address of(&) and Indirection (*) operator in Pointers I C Programming

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

КОМЕНТАРІ • 445

  • @Chris-vt6nl
    @Chris-vt6nl Рік тому +354

    Today is March 1st which is your birthday wish your a very happy birthday🎂🎂the best programming teacher on youtube

    • @Masti.Wallah
      @Masti.Wallah 11 місяців тому +2

      Ur birthday is also come on 1st March!

  • @chinweokwugiftchiedozie1587
    @chinweokwugiftchiedozie1587 2 роки тому +68

    c = *q;
    *p = 20;
    Output would be c = 9 and a = 20. While p = the address of a in a hexadecimal form

  • @mdparvezquraishi8412
    @mdparvezquraishi8412 3 роки тому +182

    Mam you deserve the word "Teacher" !!!!

  • @SandipBhattacharya
    @SandipBhattacharya 2 роки тому +57

    Great video, thanks, Jenny. So, there are two pointer operators: * and &. The & is a unary operator, called “Address of” or “Reference operator” that returns the memory address of its operand.
    For example,
    j = &i;
    assigns the address of i into j. This address is the computer's internal location of the variable in memory. It has nothing to do with the value of i. You can think of & as returning "the address of". Therefore, the above assignment statement can be expressed as "j receives the address of i".
    The second pointer operator, *, called “Value at address” or “Dereference operator” or "Indirection operator" is the complement of &. It returns the value located at the address that follows. For example, if j contains the memory address of the variable i,
    k = *j;
    copies the value of i into k.
    Hope that was helpful. :)

  • @Lisha-cc6wc
    @Lisha-cc6wc 3 роки тому +47

    Best teacher of computer ever. Keep it up👍

  • @SumitKumarofficial36
    @SumitKumarofficial36 3 роки тому +116

    C= 9
    a= 20
    p=ADDRESS OF A IN HEX FORM

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

      you summed it perfectly...but why have to written c

    • @universe449
      @universe449 Рік тому +5

      Here value of a is incorrect

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

      @@universe449 why??

    • @jayaramkumar5148
      @jayaramkumar5148 Рік тому +6

      They didn't declare a value of C then how will you assign the value of C is 9?

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

      Could you please explain to me, why p will be the address of a (in hex form)? why specifically in hex format?

  • @AyushSharma-li1kn
    @AyushSharma-li1kn 3 роки тому +16

    Best teacher I have ever seen in my life😃😃🙏

  • @suryakant7977
    @suryakant7977 2 роки тому +9

    Best teacher of computer ever.

  • @PreethiPasavala
    @PreethiPasavala Місяць тому +1

    Yesterday onwards I am seeing your videos on C programming. Because you I get so much clarity on some topics in c and I got confidence for my further examination

  • @chidiebereemereuwa9306
    @chidiebereemereuwa9306 Рік тому +121

    according to the above block of code:
    int a =10, b = 9;
    int c;
    int *p,*q;
    p=&a;
    q=&b; // the pointer 'q' declaration here means that the address-of 'b' is assigned as
    // the value of q
    c = *q; // here is the declaration of c to *q or &b. This means that using the indirection
    // operator or dereferencing * operator: the value of the variable is accessed.
    // in this case the variable is 'b'
    *p = 20; // this will manipulate the value of the variable which p points to: 'a'
    // 'a' variable was initially 10 now value will be '20'
    printf("c = %d",c) // the output will be exactly the value at variable 'b'
    printf("a = %d",a) // the output will be the current assigned value to *p which is 20
    🏑🏑i hope this was helpful to someone to understand better the output of c.

    • @swapnapanuganty3489
      @swapnapanuganty3489 Рік тому +7

      Nice explanation, Just wanted to add in the line c = *q; it basically means that c = 9; because dereferenced q is pointing to the value of b which is 9.

    • @chidiebereemereuwa9306
      @chidiebereemereuwa9306 Рік тому +1

      Yea: exactly.. thank you.
      c = 9

    • @PaulineR-xs3kx
      @PaulineR-xs3kx 10 місяців тому +1

      understood . thanks

  • @19_jothikams23
    @19_jothikams23 3 роки тому +111

    Ans
    C=9
    a=20
    P= address of a in hexadecimal format

    • @anuragmalviya2397
      @anuragmalviya2397 3 роки тому +7

      Value of a might be 10 only as ma'am has written %d then a and in the starting of prog value of a is 10.

    • @praveensamuel8083
      @praveensamuel8083 3 роки тому +11

      here a=*p,
      so the value of a is 20 only
      here we are assigning new value to *p so the value of a is 20 ...
      correct me if I'm wrong 😶

    • @keenkumar5134
      @keenkumar5134 2 роки тому +6

      *p= 20; i.e value at address of a(here 1000) so *(1000) = 20 or simply a= 20

    • @neelirahul7892
      @neelirahul7892 2 роки тому +3

      @@praveensamuel8083 bro a=*p is not declared at all
      How can you say that it's out put is 20 .
      It's 10 for sure

    • @juryrigging
      @juryrigging 2 роки тому +6

      ​@@neelirahul7892 Nope, a = 20.
      Look again at the second original printf statement: printf ("a = %d", *p) , 10
      It's an instruction to print "a =" value of *p. It was written to show you that this is so, even though it isn't formally declared. a = *p is inferred from p = &a:
      a = 10, p = &a
      p points to the address of a (&a).
      *p points to the value held at &a.
      &a is the location that holds the value of a.
      *p points to the value of a.
      a = *p
      *p = 10
      Both a and *p are the same data stored in memory at &a, so cannot be two different values. As long as p = &a, for *p = 20 to be true it must override a = 10. If you don't understand this you can accidentally overwrite your variables when using pointers.

  • @lokeswaripanchireddi-z6l
    @lokeswaripanchireddi-z6l Рік тому +3

    Mam I like your way of explaining the subject to students 👌, you are the best programming languages teacher for me......

  • @john_avernia
    @john_avernia 2 роки тому +32

    I'm in the middle of doing my CS course, and this helps me a lot on understanding pointers (which apparently is a very hard subject that even the veterans hates).
    She's a great teacher.

    • @Nature-k1r
      @Nature-k1r Місяць тому

      @@john_avernia hey which year??

  • @shinyrao2786
    @shinyrao2786 3 роки тому +147

    As we taken c=*q which means *q gives the value of b. Because q=&b;
    *q = value of b. Therefore the c=b;
    C= 9.

  • @Vikram-b
    @Vikram-b Рік тому +2

    Thanks mam me 5 din se smjh nhi pa rha tha pointer apka video dekha smjh agya

  • @jxtin1007
    @jxtin1007 Рік тому +4

    very beautiful teacher.

  • @udaysinghrana5725
    @udaysinghrana5725 2 роки тому +8

    c=&q which means c=*(&b) value at memory location of variable b.
    *p = 20 this means *(&a) value 20 will be stored at variable a and will pointer will point to address of memory a

  • @beneelohimhub
    @beneelohimhub Рік тому +13

    The printf("C = %d, c) will give us 9, the printf("a = %d", a) will give us 20 and the printf("%x", p) will give us 0x8000.

    • @heysuraj-ik1rd
      @heysuraj-ik1rd Рік тому +1

      correct

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

      @@heysuraj-ik1rd Thank you...

    • @nandinil8723
      @nandinil8723 Рік тому +1

      How pls explain a and p values

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

      ​@@nandinil8723 p is storing the address of a, that is it has a direct access to whatsoever value that is stored in a, so when you dereference p, what you get is the direct value of a, so dereferencing p and giving it a value of 20 is the same as updating the value stored at the address of a, which initially was 10 to the new value, which is now 20. I believe you understand it now?

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

      @@nandinil8723 While p is the hexa-decimal value of p, that's the hexa-decimal value of 20.

  • @chinnapareddyKothapalli
    @chinnapareddyKothapalli Місяць тому

    🎉🎉🎉😊😊😊 super excited about the topic learn more about the t

  • @iAmAjayTeli
    @iAmAjayTeli 2 роки тому +2

    Mam you are amazing
    I always watch only your video when i don't understand in my college
    You are better than my college teacher

  • @eshuvgautam3186
    @eshuvgautam3186 3 роки тому +4

    Mam whenever you teach us everything is FINE!

  • @nasirkhatib3836
    @nasirkhatib3836 2 роки тому +2

    Best teacher of computer in india

  • @vickyvignesh3844
    @vickyvignesh3844 3 роки тому +10

    mam waited for pointers for a long time thanks for start uploading mam!!.please post all videos as soon as possible mam.please try to upload 2 videos per day mam.Thank you mam.

  • @totoplopp6630
    @totoplopp6630 Рік тому +1

    She got me through my bachelor in computer science more than any teacher at Uni

  • @theshashankgaming1231
    @theshashankgaming1231 Рік тому +2

    mam thanks lot your teaching style is very awesome slowly slowly helps me to understand all the topics
    thanks a lot mam you are best

  • @Aditya-sn4le
    @Aditya-sn4le Рік тому +1

    Ma'am you are literally the best teacher ever!!!!

    • @Aditya-sn4le
      @Aditya-sn4le Рік тому

      No one can beat u in being the best teacher ever for C programming.

  • @kocengineering769
    @kocengineering769 3 роки тому +21

    Mam c=9 only
    As you told us to comment on
    C=*q
    So it must be 9
    In the program while you were running you have given
    C=*p
    Which will give a value 10
    I got it mam
    Thanks

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

      C=*q
      That means it should print value of 'C' but where Is C value

  • @helloworld2054
    @helloworld2054 2 роки тому +6

    For second question it's not clear whether ma'am had declared the value of a as 10 or 20.
    If you declare value of a as 10 then the output will be 10, if you declare it as 20, output will be 20. (run the code on your PC to verify)So value of a cannot be updated using *p. Whatever the value of a is declared first that will be printed.
    And for the third one it will print address of a in hexadecimal form

  • @ChillOutinLove
    @ChillOutinLove 3 роки тому +17

    a) c = *q , then value of c is 9
    b) *p = 20 means value at (&a) is 20.
    c) value of p is address of 'a' in hexadecimal form.

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

      Thanks bro for this easy way

    • @alaharianuhya9523
      @alaharianuhya9523 2 роки тому +1

      Can you pls tell me how the value of a is 20

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

      @@alaharianuhya9523 we used there indirectional operator that is * which prints the value of 'a' at address of 'a'
      (As we already declared above that 'p' stores the address of the variable 'a')

  • @sairampolisetty2059
    @sairampolisetty2059 3 роки тому +9

    Thank you soo much mam ❤️😀
    I have understood clearly.

  • @ayyoubezzouine
    @ayyoubezzouine Рік тому +2

    best teacher ever !thank you so much

  • @shinyrao2786
    @shinyrao2786 3 роки тому +4

    *p=20; which means value of a will be overwritten by 20.a=20;

  • @manojrajput9930
    @manojrajput9930 3 роки тому +6

    a = 10
    P = 1000EF( in hexadecimal form)
    C = 9

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

      A will be 20 bro change kar di hai val. A ki pointer se

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

      @@kushpreetbakshi4828 hello.
      Value is coming out to be 10 when I run it in VS code.
      And after this
      I also print
      Printf("%d", *p) ;
      So value is coming 20 there.
      How come?

  • @Mogiwara3B
    @Mogiwara3B Місяць тому

    your method of teaching is very good, thank you

  • @codeMantra272
    @codeMantra272 2 роки тому +3

    Thanks ma'am your video clear my all doubt ☺️

  • @Games_with_Aryan365
    @Games_with_Aryan365 2 роки тому +2

    Answer
    C=9
    a=20
    P=it store the address of other variable in hexa decimal form...

  • @ankitanand4101
    @ankitanand4101 Місяць тому

    Crystal clear mam thanks

  • @vaibhavsinhbihola1
    @vaibhavsinhbihola1 3 роки тому +3

    15:29 answer is 9
    16:18 for value of a answer is 20 and for value of p answer is 1000

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

      exactly hexadecimal value of p is 1000 only....
      y bcoz here p have address of variable 'a'...
      condition: P=&a

  • @suvashreepriyadarshinibisw8017
    @suvashreepriyadarshinibisw8017 2 роки тому +14

    C = 9
    A= 20
    P = hexadecimal number

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

      if you suddenly open 15:38 it looks like b=a lol, in that case value of C would be 10 which I thought, because it looked like that to me lmao

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

      9

  • @harshpandey3500
    @harshpandey3500 3 роки тому +5

    It's very useful mam thanks for this information

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

      ua-cam.com/video/oWtizowZYBc/v-deo.html

  • @Palash-vm4mo
    @Palash-vm4mo 2 роки тому +6

    Today is mam interview and these video is so beneficial for me💜

  • @jayalakshmilbhat125
    @jayalakshmilbhat125 11 місяців тому

    Best lecture ever seen..
    Happy Birthday mam ❤

  • @timjoyalle318
    @timjoyalle318 3 роки тому +22

    New to the channel. I like your style of teaching. Keep up the good work!

  • @melthabah1158
    @melthabah1158 3 роки тому +2

    The value of a now is override by 20 output is 20 for a value mam

  • @sairamkumaremani2485
    @sairamkumaremani2485 3 роки тому +3

    Thank you very much mam now concept is very much clear.

    • @coding1415
      @coding1415 3 роки тому +1

      ua-cam.com/video/oWtizowZYBc/v-deo.html

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

    Best teacher in the world❤🩷💛

  • @K.Revanth-ym2it
    @K.Revanth-ym2it Місяць тому +1

    c=9 and a=20 because the address of a is stored in p and we are changing the value which is stored in that address so value of a=20;
    and the address of p strores address of a

  • @muhammedjasil1701
    @muhammedjasil1701 Рік тому +4

    One of the great gift for Indian students..

  • @FunandLearn2512
    @FunandLearn2512 3 роки тому +1

    I am already a software developer. I don't know what I am doing here . I just came to see you everyday .

    • @timjoyalle318
      @timjoyalle318 3 роки тому +1

      I know what you are doing here...

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

      @@timjoyalle318 please enlighten me 😀

    • @timjoyalle318
      @timjoyalle318 3 роки тому +1

      @@FunandLearn2512 You're here for her beautiful mind!

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

      @@timjoyalle318 yes correct .

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

    my favourite teacher and first choose of CS

  • @taniyahettiarachchi6674
    @taniyahettiarachchi6674 3 роки тому +4

    Thank u very much mam.💪💪👍👍🙏🙏❤❤

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

      ua-cam.com/video/oWtizowZYBc/v-deo.html

  • @faithfullyfactual
    @faithfullyfactual Рік тому +4

    value of c = 9 because c is initialised to hold the value of the pointer q(which houses the address of b), which turns out to be 9. Hence, value of c printed would be 9. In case 2, the value of the address p holds (*p) is modified in memory to 20. The address p holds is of variable and since *p is modified, it means a has been modified (or corrupted). Hence the value of a printed would be 20. In the last case, p would print the address of the variable a, didn't change throughout the program.

  • @shivafoods007
    @shivafoods007 2 роки тому +7

    16:19
    Answers are:-
    c=9;
    a = 20;
    p = &a; (i.e. 1000 or assume in hexadecimal as per the example).

  • @priyanshusaraswat8892
    @priyanshusaraswat8892 Рік тому +1

    Thank you for lecture

  • @moizawan1807
    @moizawan1807 11 місяців тому

    1--
    c=*q; this will assign value of memory address that is stored in q so c will become 9
    2--
    a=10;
    *p=&a;
    *p=20;
    this time value 20 is assigned to a variable and its orignal value is overwritten by this

  • @bathureddy4456
    @bathureddy4456 3 роки тому +6

    hyderabad secunderabad jenny madam zindabad...

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

      ua-cam.com/video/oWtizowZYBc/v-deo.html

  • @harshini.m3327
    @harshini.m3327 11 місяців тому

    Haappyyy Birthday Mam!🎉 Grateful for ur videos❤

  • @yashichauhan316
    @yashichauhan316 2 роки тому +1

    in case of printf("c= %d", c); the address of pointer q is printed in integer format.
    next incase of printf("a= %d ",a); value of a willl be printed that is 10.

  • @hustlewithnik
    @hustlewithnik 3 роки тому +3

    a= 20
    p= address of a in hexadecimal form
    c=9

  • @tanish_ot7
    @tanish_ot7 2 роки тому +1

    Mam aap bhout acha padhate hoo

  • @Kaizsor
    @Kaizsor 2 роки тому +2

    Since, q is carrying the address of b, so *(&b) = b. So, the output will be 9.

  • @mukbanggie3375
    @mukbanggie3375 3 роки тому +1

    Example of beauty with brain 🥰🥰

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

      ua-cam.com/video/oWtizowZYBc/v-deo.html

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

    thnks mam it was exam.time you cleared me before going to exam......and the exam was practical exam.🥲

  • @shinyrao2786
    @shinyrao2786 3 роки тому +2

    Printf ("%x",p) gives adress of p in hexa decimal form

  • @dompelkmoviereview
    @dompelkmoviereview Рік тому +1

    C = 9
    a = 20
    p = address of a ( hexadecimal number )

  • @BiswajitMaharana1
    @BiswajitMaharana1 3 роки тому +3

    Thank you mam for uploading this.

    • @coding1415
      @coding1415 3 роки тому +1

      ua-cam.com/video/oWtizowZYBc/v-deo.html

  • @iasaspirant1441
    @iasaspirant1441 3 роки тому +2

    superb explanation madam

  • @GaganGarg-pt6bg
    @GaganGarg-pt6bg 7 місяців тому

    Now i can understand pointers

  • @asmarubiya5214
    @asmarubiya5214 3 роки тому +2

    Better than our academic lectures..

  • @MadhuKarampudi
    @MadhuKarampudi Рік тому +1

    value of c == value of b and a becomes variable so it leaves 10 value and it will get new value that is 20 a=20 and p=20

  • @misturaojulari9707
    @misturaojulari9707 2 роки тому +5

    Thanks a lot! Your class is helping me achieve the impossible

  • @KeerthiGovindasu
    @KeerthiGovindasu 5 місяців тому +2

    thank you maaam

  • @shraddhapawar5674
    @shraddhapawar5674 3 роки тому +2

    Ma'am if possible, upload video fast.
    Nice lecture 👍

  • @techienomadiso8970
    @techienomadiso8970 3 роки тому +3

    Why can't Lecturers teach with passion like this? 🤦

  • @kwameanati
    @kwameanati Рік тому +1

    Value of c is 9
    Value of a is 10
    Value of p is &a in hexadecimal

  • @nextzen9550
    @nextzen9550 2 роки тому +1

    i like your video...thx ma'am

  • @PavaniTirumani-p7i
    @PavaniTirumani-p7i 2 місяці тому

    C=*q ,*q represents the address of b in which b value is present and print the value c= 9

  • @shrutichauhan4935
    @shrutichauhan4935 2 роки тому +2

    Your class is awesome mam❣🥰

  • @yashreddy2149
    @yashreddy2149 2 місяці тому

    i found u finally 😇😇

  • @nextzen9550
    @nextzen9550 2 роки тому +1

    very very thank you so much ma'am

  • @ramu6313
    @ramu6313 2 роки тому +1

    q contains the address of b(q=&b)
    *q contains the value of b=9
    So c=9(c=*q(

  • @YashwanthCheerla
    @YashwanthCheerla 11 місяців тому +1

    Happy Birthday 🎉

  • @lucy2003-d8p
    @lucy2003-d8p 3 роки тому +1

    Thanks mam alot😍😍😍😍😍😍😍

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

    Thank you so much mam 🏵️🏵️🏵️... really greatful to you mam

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

    best mam ever.❤❤

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

    your classes are awesome 😎😎😎 mam

  • @megh5013
    @megh5013 2 роки тому +2

    Thanks a lot Mam for this lecture!!!

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

    c outputs 9
    the value of a is 20
    p prints the memory address of a in hexadecimal

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

    15:28 *q=&b; here *q=9; then c=*q; so c will equal to 9

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

    c=*q; since q stores address of b so the value at that address will be stored in c i.e 9

  • @vrengineers2462
    @vrengineers2462 2 роки тому +1

    ankit and pulkit will remember forever

  • @invincible9971
    @invincible9971 3 роки тому +1

    printf("c=%d",c); output is: 9

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

    Value of c is 9
    Value of a is 20
    Value of p is the address of a which in our case it's 1000 but will actually be in hexadecimal form

  • @kreddeppa5187
    @kreddeppa5187 3 роки тому +1

    Nice hair style Mam😍😍😍

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

      ua-cam.com/video/oWtizowZYBc/v-deo.html

  • @hariparuchuru3858
    @hariparuchuru3858 2 роки тому +5

    what I understood I
    if we initialize
    int a=10;
    int *p;
    p=&a;
    *p=44;
    printf("%d", a);
    then it will print a=44;
    i think here we are changing the value stored in a through pointers
    i.e if p is having address of a
    the *p says value stored at the address
    means if we initialze *p =44; means we are initializing value to a.

  • @atharvabadgujar9868
    @atharvabadgujar9868 2 роки тому +1

    value of a will get printed
    the adress of p will get printed in another case

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

    thank you soo much jenny madam❤

  • @Top10-i8q8u
    @Top10-i8q8u 2 роки тому +1

    Her Eye contact 😘

  • @ahmadcomputers2291
    @ahmadcomputers2291 3 роки тому +1

    Madam |G Thank You ""Good Job

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

      ua-cam.com/video/oWtizowZYBc/v-deo.html

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

    Mam your voice is so sweet . I feel sleepy