C_75 Pointers in C-part 5 | Pointer Arithmetic (Addition) with program

Sdílet
Vložit
  • čas přidán 10. 09. 2024
  • In this lecture we will discuss Pointer Arithmetic. How to perform addition with pointers.
    Best C Programming Tutorials: • Programming in C
    *********************************************
    Connect & Contact Me:
    Jenny's Lecture Hindi: / @jennyslectureshindi
    Facebook: / jennys-lectures-csit-n...
    Quora: www.quora.com/...
    Instagram: / jayantikhatrilamba
    Twitter: / khatrijenny
    Telegram Group Link: Jenny's Lectures
    telegram.me/je...
    *******************************************
    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

Komentáře • 182

  • @ashishphaltankar
    @ashishphaltankar Před 3 lety +77

    Now I'm not attending my college lectures of Programming in C.
    I'm Attending the lectures of this channel.
    Mam you teach far far better than My college professors.
    Indeed I wasted my money in my college to learn Programming but fact is I'm learning Programming from you mam that also toataly free.

  • @codeishard3182
    @codeishard3182 Před 2 lety +148

    Now, p = 1012( or it points a[3] )
    *p = 2; means value at p or at address 1012 is 2;
    so, now a[3] = 2; *p will print 2.

    • @omnamahshivaya7081
      @omnamahshivaya7081 Před 2 lety +4

      It will point for a[1] as mam has given p=p+1

    • @madhavan.1209
      @madhavan.1209 Před 2 lety +12

      @@omnamahshivaya7081 she already changed the value in *p =1008 (p=p+2) now p+1 =1012 the *p is pointing & of 1012 the & has value a[3]=10 then changed to 2

    • @ananyaghosh6402
      @ananyaghosh6402 Před rokem

      what was internal pointer Again?

    • @NTuRN11
      @NTuRN11 Před rokem +2

      @@ananyaghosh6402 i think it points to the base address of the variable,,,,like in this code a is the internal pointer who is pointing to 1000(base address of the variable)...........nah bro im so confused...😭

    • @mhsujal417
      @mhsujal417 Před rokem +1

      2 print ❤

  • @bawaabdulsilas3681
    @bawaabdulsilas3681 Před rokem +30

    Before the line p = p + 1;
    Pointer p was pointing to this address [1008];
    So when the line p = p + 1 is executed, then p will be pointing to the next address which is [1012];
    On the next line *p = 2, reassigned the value at address [1012] which is 10 to 2;
    Finally, address [1012] now stores 2, and the statement printf("%d
    ", *p) will print 2 on the screen.

  • @anandsinha2289
    @anandsinha2289 Před rokem +3

    After p=p+1;
    As we see it is giving the address of 1012 and it is storing 3 so as *p=2;
    Now at address of 1012 value 3 will be assigned

  • @yashhokte1020
    @yashhokte1020 Před 2 lety +13

    17:56 may be a[3] stored the value 2 and *p will print 2 value

  • @navneetrampal3977
    @navneetrampal3977 Před 2 lety +5

    Actually ma'am you don't believe I took online subscription to learn coding but still I am here and watching lectures of pointer there are the n numbers of videos on you tube but the concepts that you clear that's really amazing thank you by heart tomorrow is my exam

  • @Riyaaa677
    @Riyaaa677 Před 2 lety +55

    I guess value of a[3] will b modified to 2

    • @ginilance7427
      @ginilance7427 Před 10 měsíci +2

      It will be modified to -8.
      1 is at index 0.
      4 is at index 1
      2 is at index 2
      -8 is at index 3
      0 is at index 4

    • @chiragmaloo7504
      @chiragmaloo7504 Před 9 měsíci +2

      @@ginilance7427 wrong hai

    • @MitikuMitihans
      @MitikuMitihans Před 5 měsíci

      Hey how are you where are you from

    • @Jardaani_Jovonovich
      @Jardaani_Jovonovich Před 4 měsíci +1

      @@MitikuMitihans chaduvukora gaadidha...

    • @O_bi_to7
      @O_bi_to7 Před 3 měsíci

      Probably

  • @satyavansharma4213
    @satyavansharma4213 Před 3 lety +5

    Nice mam thanks for this type videos i pray to God your chennel get the 5 million subscribes

  • @faithfullyfactual
    @faithfullyfactual Před rokem +1

    current value of *p is now 2. hence printf("%d", *p); would print 2. That also means that a[3] has also been modified to be 2.

  • @python-2023
    @python-2023 Před 2 lety +5

    Mom some of your videos don't have subtitles please add subtitles in all of your videos
    Thank you

  • @tirthtanna7771
    @tirthtanna7771 Před 3 lety +9

    Mam you are the lifeline for many students

  • @vickyvignesh3844
    @vickyvignesh3844 Před 3 lety +6

    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!!

  • @tirthtanna7771
    @tirthtanna7771 Před 3 lety +7

    the value of *p will be 2

  • @khushichoudhary5996
    @khushichoudhary5996 Před rokem +1

    p is a pointer and if *p=2 then in pointer p, 2 is not going to store because p is a pointer and pointer can only store address not any integer value.

  • @imadbenmadi
    @imadbenmadi Před rokem +2

    thank u very mush , i was having a big problem in understanding pointers and work with theme . its a really simplify explication thanks for all your hard work

  • @vimala7830
    @vimala7830 Před 3 lety +10

    Thanks a lot mam for your very clear explanation ☺️

  • @devayanirajendran4005
    @devayanirajendran4005 Před 2 lety +3

    Pls anybody explain if I get input from user by using for loop thn I store address of a as *p=a[i ]

  • @vinitkumar.3588
    @vinitkumar.3588 Před 3 lety +2

    You are the best teacher ma'am

  • @priyeshmalviya1886
    @priyeshmalviya1886 Před 2 lety +2

    Mam if pointer has no data type then why its a need to use format specifier of related data type while using printf.

  • @Busy_girl-mq2cf
    @Busy_girl-mq2cf Před 7 měsíci

    p=address of 3 and *p means that the value in which the pointer is pointing will change to 2 . So the out put will be 2

  • @yannamsettiaishwarya7448
    @yannamsettiaishwarya7448 Před 2 lety +3

    int *p=&a[1] is it possible mam..or we should give only for base address..?

  • @etceterafans2345
    @etceterafans2345 Před 2 lety +4

    *p=2;
    printf("%d", *p);
    it will give the output of 2

  • @SumangalaSipoy-tj3ey
    @SumangalaSipoy-tj3ey Před 5 měsíci +1

    p+1; value is -1 itself mam

  • @freefiregamer076
    @freefiregamer076 Před 10 měsíci

    The way of explaining it's easy for me

  • @brundar860
    @brundar860 Před 2 lety +2

    Hlo mam I think if you take only the theory party , that would be enough no need of practical

  • @engineernijo95
    @engineernijo95 Před 2 lety +2

    maam which application do you use to compile programs if you don't mind send me the link to download

  • @maryannemuthoni5388
    @maryannemuthoni5388 Před 7 měsíci

    p + 1;
    printf("%d", *p);
    *p will still be value of the first element 0, if one wanted it to point to the second element it should be p = p + 1;
    The second question: (This is if we are assuming p points to the first element p[0]:)
    p = p + 1;
    p will not point to the second element *p will be equals to one then when you do *p = 2 the value for the second element p[1] becomes 2

  • @chetansingh55
    @chetansingh55 Před 3 lety +2

    Thanks mam. These videos are too helpful to me. Thanks for frequent uploading of videos❤

  • @abdulrahimjalloh363
    @abdulrahimjalloh363 Před rokem

    p=p+1;
    *p=2;
    printf("%d",*p); .............Since P has already pointed to 1012, it means the value at 1012 will be changes to 2.

  • @tmr1947
    @tmr1947 Před 3 lety +3

    mam how to start gate preparation in my 1st year. will you plz tell me tips and best online resources🙏🙏🙏

  • @arshuarshad1551
    @arshuarshad1551 Před 8 měsíci

    16:46 if we write p+1 than it will not give error it will give base value of array element which define before this statement like this *p=&a[0];

  • @dineshkantineni6232
    @dineshkantineni6232 Před 2 lety +2

    mam please discuss about storage classes
    your videos is very helpful to me

  • @tanmay5070
    @tanmay5070 Před měsícem

    ma'am, int takes 4 bytes in a 64 bit machine and 2 bytes in a 32 bit machine

  • @yannamsettiaishwarya7448
    @yannamsettiaishwarya7448 Před 2 lety +1

    i have a doubt that..for integer 2 bytes..
    but mam is telling that 4 bytes.. i think its iong int.. why we took that..?

  • @SravanKumar-uc6qt
    @SravanKumar-uc6qt Před 3 lety +1

    Respected madam zi,
    Pointer is different statement function
    Arthemetic is different statement function
    How can you write this programm
    May it not possible,
    May be it will possible is coding, development data, algorithm

  • @megh5013
    @megh5013 Před 2 lety +2

    Thanks a lot Mam for this lecture!!!

  • @vanshikagarg7586
    @vanshikagarg7586 Před rokem +1

    output will be :
    0
    -1
    2

  • @meghasinha1706
    @meghasinha1706 Před 3 lety +2

    Thanks for your efforts mam

  • @atomsherlock6647
    @atomsherlock6647 Před 3 lety +2

    Hi, Mam, may games as exercises would complete perfectly your lessons ? Thanks anyway.

  • @devSackey
    @devSackey Před rokem

    it will print 2; Thanks for the free explanation

  • @akhilmittal3283
    @akhilmittal3283 Před 2 lety

    padhke like bhi kr diya kro yrr itti acchi mam hai

  • @bainaboyinakarthik9945
    @bainaboyinakarthik9945 Před 5 měsíci +1

    Mam pointers topic ,I feel some difficult

    • @Vemon564
      @Vemon564 Před 4 měsíci

      I fell array string is hard to understand😉

    • @lifemalayalamyoutube7192
      @lifemalayalamyoutube7192 Před 2 měsíci

      Think simply, pointer is just a variable(means, a location in memory).Unlike usual variables which store a value, this pointer stores the address of other variables.
      Think about the example, to know your address, one can ask your relative. Your relative is like a pointer variable😊

  • @vishalG777
    @vishalG777 Před rokem

    Why are performing arithmetic operations on pointer just to access the different values of arrays, we can simply access different elements using the index of that element!

  • @mdmonisali9177
    @mdmonisali9177 Před 3 lety +2

    Mam please explain about enumerated data type

  • @anujeetkunturkar780
    @anujeetkunturkar780 Před 3 lety +2

    It will print 2.

  • @Cm-zc2zx
    @Cm-zc2zx Před 8 měsíci

    Thank you so much mam ...
    Yhi to sikhna tha muze 😊😊

  • @meme_engineering4521
    @meme_engineering4521 Před 3 lety +1

    Kaash mere school time pe aapka channel hota 😭

  • @SumangalaSipoy-tj3ey
    @SumangalaSipoy-tj3ey Před 5 měsíci

    p=p+2; value of *p=-1
    p=p+1; value of *p=10
    *p=2; value of *p=2

  • @venkatesh3833
    @venkatesh3833 Před rokem

    Thanks a lot mam for your clear explanation

  • @williemungai1954
    @williemungai1954 Před 2 lety

    *p will print out 2...the value of a[0] will be changed to 2

  • @l.lawliet4636
    @l.lawliet4636 Před 2 lety

    Value of *p will finally be 2
    Value stored at 1012 will be replaced by 2....

  • @okunoyesouleiman9117
    @okunoyesouleiman9117 Před rokem +1

    can I download the play list in one video ?

  • @ManjuSingh-hz8tr
    @ManjuSingh-hz8tr Před 3 lety

    Mam. I want to join your Ur class ...but mujhe samaj nii aara kese join hoga to plz help kr do

  • @codingworlds724
    @codingworlds724 Před 3 lety

    last question answer is *p = 2 then it will show 2 answer it will change the value

  • @prashantpatel4636
    @prashantpatel4636 Před 3 lety

    Mam abhi kitne video aur aayenge c language ke??...
    Means kitne topics remaining hai?

  • @DilkhushKumar-dc8ed
    @DilkhushKumar-dc8ed Před 10 měsíci

    Is it write :-
    int a=3;
    int *p=&a;
    p=p+a;

  • @layson8072
    @layson8072 Před 9 měsíci

    It will print => 2

  • @Mr_Kumar_Sai
    @Mr_Kumar_Sai Před rokem

    2 will print in the address location 1012.

  • @barathkumarg3461
    @barathkumarg3461 Před 3 lety

    Very useful for gate mam

  • @Shylakarigowda-zq5ho
    @Shylakarigowda-zq5ho Před rokem

    Ans=2

  • @intellectualclasses1857
    @intellectualclasses1857 Před 3 lety +1

    Ma'am do you take live classes?
    Please reply me Ma'am!

  • @AvinashKashyap-ux9ch
    @AvinashKashyap-ux9ch Před 10 měsíci

    0:53--2:33 promotion. Skip this part.

  • @motemontero5592
    @motemontero5592 Před 3 lety

    Please madam after completing this c programming we need GTK+ FOR C PROGRAMMING

  • @ChillOutinLove
    @ChillOutinLove Před 3 lety +1

    Ma'am p is pointer and size of pointer is 8 , then how we can't do
    p = p + 2 ,
    p = 1000 + 2*8
    p = 1016
    Ma'am pls clear my doubt

    • @guddititejesh5426
      @guddititejesh5426 Před 2 lety +2

      You can't write 2*8 instead of this you write 2*4 because it is a integer type it contains 4 bytes..

    • @SwetaKumari-ps2rf
      @SwetaKumari-ps2rf Před 2 lety +1

      Pointer is not a data type ...so u cannot multiple with 2..here data type is integer .so we can use 4 intead of 8

  • @sourabhpandey2706
    @sourabhpandey2706 Před 2 lety

    Error hai
    *p=2 but pointer ka datatype define hi nahi hai
    *p means pointer variable
    .....

  • @GalaxyCookies76
    @GalaxyCookies76 Před rokem

    Hatts off Big fan from Pakistan

  • @phanimanojoleti6606
    @phanimanojoleti6606 Před 2 lety

    Class is nice mam.but on pc we are not able to see the letters .please try to zoom it mam

  • @dominicamaria2897
    @dominicamaria2897 Před 3 lety

    18:53
    error: assignment to expression with array type
    p=p+2, a=a+2;
    ^
    It is showing error madam.👆

  • @lyricals816
    @lyricals816 Před rokem

    You are amazing mam

  • @sharathshar
    @sharathshar Před 2 lety

    Beauty with brain

  • @kwameanati
    @kwameanati Před rokem

    The value of *p is 2.

  • @itzharivlog273
    @itzharivlog273 Před 3 lety +2

    Make a python tutorial

  • @themonstersgaming9711
    @themonstersgaming9711 Před 3 lety +3

    So beautiful

  • @peymanschule9902
    @peymanschule9902 Před 8 měsíci

    thanks
    🥲

  • @satyajitmanna8501
    @satyajitmanna8501 Před 2 lety

    *p=2; korla a[3] ta 2 store hoba .

  • @k.nirmalnethra6194
    @k.nirmalnethra6194 Před měsícem

    Answer would be 2

  • @tejaskharde9122
    @tejaskharde9122 Před 2 lety

    24:41 after changing *p value what happened if we print whole array did i lt print like this {1,4,34,-8,0} or it print original array

    • @TheGoldFarhad
      @TheGoldFarhad Před 2 lety +1

      No, only the array we are on will change its value. So in this case we are on a[4]. So a[4] = 2 now.
      when printing all arrays we will get " 0,1, -1, 2, 11 "

  • @7VNMusic.
    @7VNMusic. Před rokem

    suddenly, mujhe c language mai interest aane laga

  • @ashutoshpatidar4903
    @ashutoshpatidar4903 Před rokem +1

    Value at 1000 will be change to 2

    • @yashahuja1550
      @yashahuja1550 Před rokem

      no bro, value at 1012 will be changed to 2

  • @Sunrise-Cricket-2358
    @Sunrise-Cricket-2358 Před rokem

    It will give 2, because we have assigned it.

  • @BTCIV_AyushMalviya
    @BTCIV_AyushMalviya Před 2 lety

    Thankyou Mam

  • @amanbhatt8506
    @amanbhatt8506 Před rokem

    Thanks mam ❤

  • @arundharekar4984
    @arundharekar4984 Před rokem

    i guess the 3rd element of array is replaced by 2....
    then it will print 2.

  • @user-ku3oh6mi9y
    @user-ku3oh6mi9y Před 3 měsíci

    You are soo cute yaaar😊🎉

  • @kamalraj7526
    @kamalraj7526 Před rokem

    start 2:32

  • @SravanKumar-uc6qt
    @SravanKumar-uc6qt Před 3 lety

    Respected madam zi,

  • @softdevrajanikant3750
    @softdevrajanikant3750 Před 2 lety

    Integer are stored 2 byte not 4 byte

  • @nehamaheshwari1502
    @nehamaheshwari1502 Před 3 lety

    After competing c lang...mam plz upload the video on java...

  • @OooHo
    @OooHo Před 7 měsíci

    -1

  • @rashmikoiri8860
    @rashmikoiri8860 Před rokem +1

    Good evening ma'am,
    Ma'am when I use increment for pointer the address of the array elements Is increased by 2 not 4.why?

    • @Mrfactzzz-t4r
      @Mrfactzzz-t4r Před rokem +1

      Depends on your computer i think

    • @kaushikr8133
      @kaushikr8133 Před rokem

      it depends on the processor.... u must be using 32 bit compiler where int size is 2 byte.

    • @NishaSharma-kl3tp
      @NishaSharma-kl3tp Před rokem +3

      @@kaushikr8133 not 2 byte it will be 4 byte ...if u have 16 bit processor than it will be 2 byte

  • @DailySongs12
    @DailySongs12 Před 2 lety

    in array a[2] is update as 2

  • @sayujprashanth3721
    @sayujprashanth3721 Před 3 měsíci

    akka from where are you?

  • @aniketkumar3126
    @aniketkumar3126 Před 3 lety

    Love you mam ❤

  • @muhammadsufyan7711
    @muhammadsufyan7711 Před rokem

    good

  • @santhasantha6005
    @santhasantha6005 Před 2 lety

    I love u Jenny❣️❣️❣️💞💞💞

  • @chessforlearners5873
    @chessforlearners5873 Před 3 lety

    if p=a+2 ...then what

  • @rapakalokesh8449
    @rapakalokesh8449 Před rokem

    take care maam 🤗🤗

  • @shanayasingh7949
    @shanayasingh7949 Před 2 lety

    Mehnet 💥

  • @chaukseyneeti9761
    @chaukseyneeti9761 Před 3 lety

    mam please speak little louder so it can be audible

  • @sourabhpandey2706
    @sourabhpandey2706 Před 2 lety

    *p=2 does not make any sense