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

Поділитися
Вставка
  • Опубліковано 9 сер 2021
  • In this lecture we will discuss:
    - What is Address of(&) operators?
    - What is Indirection Operator(*)?
    - how to use Address of(&) and Indirection(*) operator?
    Best C Programming Tutorials: • Programming in C
    *********************************************
    Connect & Contact Me:
    Jenny's Lecture Hindi: / @jennyslectureshindi
    Facebook: / jennys-lectures-csit-n...
    Quora: www.quora.com/profile/Jayanti...
    Instagram: / jayantikhatrilamba
    Twitter: / khatrijenny
    Telegram Group Link: Jenny's Lectures
    telegram.me/jennyslectures
    *******************************************
    More Playlists:
    Programming in C Tutorials: • Programming in C
    C++ Tutorials for beginners: • Lec 1: How to Install ...
    Printing Pattern in C: • Printing Pattern Progr...
    Best Python Tutorials for Beginners: • Python - Basic to Advance
    Placement Series: • Placements Series
    Data Structures and Algorithms: https: • Data Structures and Al...
    Design and Analysis of Algorithms(DAA): • Design and Analysis of...
    Dynamic Programming: • Dynamic Programming
    Operating Systems tutorials: // • Operating Systems
    DBMS Tutorials: • DBMS (Database Managem...
    Tags:
    pointers in c, what is pointer, introduction to pointers in c
    #coding #strings #jennyslectures #cprogramming #clanguage

КОМЕНТАРІ • 402

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

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

    • @Masti.Wallah
      @Masti.Wallah 4 місяці тому +1

      Ur birthday is also come on 1st March!

  • @chinweokwugiftchiedozie1587
    @chinweokwugiftchiedozie1587 Рік тому +24

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

  • @mdparvezquraishi8412
    @mdparvezquraishi8412 2 роки тому +154

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

  • @chidiebereemereuwa9306
    @chidiebereemereuwa9306 7 місяців тому +75

    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 місяців тому +5

      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 5 місяців тому

      Yea: exactly.. thank you.
      c = 9

    • @PaulineR-xs3kx
      @PaulineR-xs3kx 4 місяці тому

      understood . thanks

  • @Unknown-cc6wc
    @Unknown-cc6wc 2 роки тому +44

    Best teacher of computer ever. Keep it up👍

  • @19_jothikams23
    @19_jothikams23 2 роки тому +105

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

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

      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 2 роки тому +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 роки тому +2

      @@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 Рік тому +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.

  • @SumitKumarofficial36
    @SumitKumarofficial36 2 роки тому +112

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

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

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

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

      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?

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

    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.

  • @SandipBhattacharya
    @SandipBhattacharya Рік тому +45

    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. :)

    • @chidiebereemereuwa9306
      @chidiebereemereuwa9306 7 місяців тому +4

      Excellent explanation

    • @sparkx18
      @sparkx18 6 місяців тому +1

      Yes Thank You 🙏❤️ Nice Explanation 🙏❤️👏

  • @suryakant7977
    @suryakant7977 Рік тому +9

    Best teacher of computer ever.

  • @johnavernia1026
    @johnavernia1026 Рік тому +31

    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.

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

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

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

    Best teacher of computer in india

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

    Mam whenever you teach us everything is FINE!

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

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

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

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

  • @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 10 місяців тому +1

      correct

    • @beneelohimhub
      @beneelohimhub 10 місяців тому

      @@heysuraj-ik1rd Thank you...

    • @nandinil8723
      @nandinil8723 8 місяців тому +1

      How pls explain a and p values

    • @beneelohimhub
      @beneelohimhub 8 місяців тому

      ​@@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 8 місяців тому

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

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

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

  • @user-mz6bm2zf9d
    @user-mz6bm2zf9d Рік тому +2

    best teacher ever !thank you so much

  • @suvashreepriyadarshinibisw8017
    @suvashreepriyadarshinibisw8017 Рік тому +14

    C = 9
    A= 20
    P = hexadecimal number

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

      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 Рік тому

      9

  • @Vikram-b
    @Vikram-b 6 місяців тому +2

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

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

    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

  • @udaysinghrana5725
    @udaysinghrana5725 Рік тому +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

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

    Your class is awesome mam❣🥰

  • @vickyvignesh3844
    @vickyvignesh3844 2 роки тому +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.

  • @theshashankgaming1231
    @theshashankgaming1231 9 місяців тому +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

  • @user-km7rt8mo3p
    @user-km7rt8mo3p 5 місяців тому +2

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

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

    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

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

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

  • @jxtin1007
    @jxtin1007 8 місяців тому +4

    very beautiful teacher.

    • @user-rt9js7kg1m
      @user-rt9js7kg1m 5 місяців тому

      truely. that itself keeps us hooked 😅

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

    my favourite teacher and first choose of CS

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

    Thanks ma'am for making this video it's very useful

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

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

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

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

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

    superb explanation madam

  • @kocengineering769
    @kocengineering769 2 роки тому +20

    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

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

    thank you soo much jenny madam❤

  • @thedata-ist
    @thedata-ist 2 роки тому +2

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

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

    i like your video...thx ma'am

  • @ChillOutinLove
    @ChillOutinLove 2 роки тому +16

    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 Рік тому +1

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

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

      @@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')

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

    Thanks for your efforts mam

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

    very very thank you so much ma'am

  • @priyanshusaraswat8892
    @priyanshusaraswat8892 5 місяців тому +1

    Thank you for lecture

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

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

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

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

  • @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.

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

    Thanks a lot Mam for this lecture!!!

  • @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...

  • @Aditya-sn4le
    @Aditya-sn4le 9 місяців тому +1

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

    • @Aditya-sn4le
      @Aditya-sn4le 9 місяців тому

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

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

    Thank you very much mam 🙏🙏🙏

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

    Best teacher in the world❤🩷💛

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

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

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

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

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

    your classes are awesome 😎😎😎 mam

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

    Mam it's very useful mam,can you please upload the videos of protocols like spi,i2c,can, UART

  • @manojrajput9930
    @manojrajput9930 2 роки тому +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?

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

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

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

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

  • @muhammedjasil1701
    @muhammedjasil1701 11 місяців тому +4

    One of the great gift for Indian students..

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

    It's very useful mam thanks for this information

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

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

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

    Thank you mam for uploading this.

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

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

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

    best mam ever.❤❤

  • @AkashSingh-fp8ji
    @AkashSingh-fp8ji Рік тому +1

    Thank you mam

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

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

  • @jayalakshmilbhat125
    @jayalakshmilbhat125 4 місяці тому

    Best lecture ever seen..
    Happy Birthday mam ❤

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

    Excellent job

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

    Amazing video.

  • @015antonyrenitaf9
    @015antonyrenitaf9 Рік тому

    thank you so much mam

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

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

  • @GaganGarg-pt6bg
    @GaganGarg-pt6bg Місяць тому

    Now i can understand pointers

  • @yashichauhan316
    @yashichauhan316 Рік тому +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.

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

    mam in c : b value
    and a value is over written
    and address of p is same
    thank you mam

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

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

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

    Mam aap bhout acha padhate hoo

  • @faithfullyfactual
    @faithfullyfactual 11 місяців тому +3

    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.

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

    ThankYou Mam

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

    hyderabad secunderabad jenny madam zindabad...

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

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

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

    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

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

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

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

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

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

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

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

    Thank you mam.

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

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

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

    Thanks mam alot😍😍😍😍😍😍😍

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

    Example of beauty with brain 🥰🥰

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

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

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

    Haappyyy Birthday Mam!🎉 Grateful for ur videos❤

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

    Great ma'am

  • @AbhishekRamaladinni-bp4jq
    @AbhishekRamaladinni-bp4jq 2 місяці тому

    Mama your teaching is excellent keep doing video

  • @user-sj3yn5dz5g
    @user-sj3yn5dz5g 10 місяців тому +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

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

    Since the value of c is the pointer q, c = 9.

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

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

  • @prassyam
    @prassyam 2 роки тому +4

    Namaste ji, can u pl provide tutorial on Oracle 10g...in Hindi

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

    ankit and pulkit will remember forever

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

    Well done

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

    Tq mam

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

    Completed the course in 1 day for exam

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

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

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

    We NEED GTK+ FOR C PROGRAMMING AFTER COMPLETING THE C

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

    Madam |G Thank You ""Good Job

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

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

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

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

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

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

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

    Better than our academic lectures..