Pointer Pointing to an Entire Array

แชร์
ฝัง
  • เผยแพร่เมื่อ 30 พ.ย. 2024

ความคิดเห็น • 109

  • @santiagomunez1347
    @santiagomunez1347 12 วันที่ผ่านมา +1

    If anyone wants to learn pointers and arrays in C, you've come to the right place. This is the best video I've found on TH-cam.

  • @DrOggy67
    @DrOggy67 3 ปีที่แล้ว +59

    This is maybe the most important lecture of the whole C course... Thanks a lot for this great explanation!

    • @hetaeramancer
      @hetaeramancer 3 ปีที่แล้ว +4

      no, most important is the fiorst couple of videos

  • @motivationmastery2327
    @motivationmastery2327 3 ปีที่แล้ว +20

    Noone could have ever taught this as much as clear as you did!Salaam Rocky bhai!!! Love you 3000!

  • @Dalia2Lily
    @Dalia2Lily 4 ปีที่แล้ว +50

    NESO Academy, I can't stop loving you guys

  • @azubuikedanielezeadim4019
    @azubuikedanielezeadim4019 2 ปีที่แล้ว +2

    Oh my God! since i have being having problem with pointers, this is the first channel that gave me a better, clear and gently explaination, not even my prof

  • @sayaknandi139
    @sayaknandi139 2 ปีที่แล้ว +11

    You guys are really good teacher and i m telling from my heart u made my programming concept more clear...For your videos i do not need a private tuitor..Thanks a lot

  • @saurabhtiwari287
    @saurabhtiwari287 3 ปีที่แล้ว +4

    Sir like Or subscribe ke alawa kuch or bhi h kya idhar bta dena koi.
    Literally sir ye topic smjhne ke lye meine thousands of money institute me spend kra h.
    Or aab yahan pr smjh me aaya h.
    Sir I pray to God aapki jholi khusiyo se bhar de. 😇😇😇

  • @adamjahani4494
    @adamjahani4494 หลายเดือนก่อน

    5 mins of learning with Neso Academy is worth a full week learning from my professor.

  • @axolet
    @axolet 4 ปีที่แล้ว +31

    Roses are red
    Violets are blue
    Neso's the best tutor for you

    • @pradhanan9413
      @pradhanan9413 3 ปีที่แล้ว +2

      Doesn't rhyme but its true❤️

  • @SerhatAtes
    @SerhatAtes 3 ปีที่แล้ว +5

    int (*p)[5] = &a; -> below printf outputs are the same because base address of first element of the array and base address of the whole array are the same;
    printf("%p", p);
    printf("%p", *p);
    printf("%p", a);
    printf("%p", &a);

  • @ericgroen253
    @ericgroen253 6 วันที่ผ่านมา

    Good explanation!!! I'm having a lot of troubles understanding Pointers and Pointers with arrays. This coms in very helpful

  • @sdk28
    @sdk28 3 ปีที่แล้ว +2

    Pointer is the thing which can get you high.
    It's really strong!

  • @prototype18
    @prototype18 3 ปีที่แล้ว +7

    You guys are seriously doing a good job
    Thank you Neso Academy!!!
    Keep up the good work!!!

  • @janardhanreddyboyalla2941
    @janardhanreddyboyalla2941 4 ปีที่แล้ว +5

    Very Useful For Us Sir. Keep going like this sir. Thank You

  • @yashjaiswal83
    @yashjaiswal83 4 ปีที่แล้ว +6

    thank you neso you cleared my doubt very very well!!

  • @yesvee7377
    @yesvee7377 3 ปีที่แล้ว +10

    Please make a course, I'll pay you to signup for it, from my heart i saying this, the example and visualization you gave for pointer to array was not even in the books, hatsoff for your wonderful wonderful work.
    This country needs more teachers like you guys in IITs and IIM's

  • @vimalathithand917
    @vimalathithand917 ปีที่แล้ว +2

    Such a wonderful video! Thanks a lot for providing such a quality content free of cost

  • @khoileminh5710
    @khoileminh5710 3 ปีที่แล้ว +2

    Your visual explanation is so helpful, keep it up!

  • @abhishektanwar2460
    @abhishektanwar2460 3 ปีที่แล้ว

    Thank You for existing Neso Academy.......the problem which disturbed me for the whole day solved in 5 Minutes.

  • @ss24567nsingh
    @ss24567nsingh ปีที่แล้ว +1

    Thank you so much neso academy for making such wonderful and helpful videos on different programming languages ..hats off to u..❤❤

  • @shubhamrahinj6864
    @shubhamrahinj6864 ปีที่แล้ว

    These c series is simply exceptional & mind blowing

  • @Ertyuiigff-sq5fi
    @Ertyuiigff-sq5fi 4 ปีที่แล้ว +4

    what a superb explanation i love it

  • @prajnasuresh2876
    @prajnasuresh2876 3 ปีที่แล้ว +3

    *p is not a pointer, it's the value to which 'p' is pointing(*p is de-referencing the value precisely) whereas p is a pointer. correct me if I am wrong?! we are usually confused reading *p as a pointer, well but it's not!!

  • @xiangli9588
    @xiangli9588 3 ปีที่แล้ว +1

    Thank you. This helped me understand arrays.

  • @khushiyadav6138
    @khushiyadav6138 3 ปีที่แล้ว +3

    Thanks for uploading such a nice video 🙂. Explained beautifully ❤️

  • @adityanpanchal6976
    @adityanpanchal6976 6 วันที่ผ่านมา

    it helped me to understand that concept @4.14

  • @santasingh9045
    @santasingh9045 3 ปีที่แล้ว +1

    Great Explanation

  • @mohammadsayem2257
    @mohammadsayem2257 3 ปีที่แล้ว +2

    Great explanation...

  • @somasekhardakala2630
    @somasekhardakala2630 5 ปีที่แล้ว +8

    good explanation and thank you🤝

  • @shivampatel8850
    @shivampatel8850 2 ปีที่แล้ว

    I like your explanation and please never not stop making such videos

  • @harmankaur3938
    @harmankaur3938 2 ปีที่แล้ว

    because of you guys i got addicted with C❤️

  • @shiksharawat6948
    @shiksharawat6948 ปีที่แล้ว

    Thank u so muchh you don't know how much you helped me at this confusing concept 😢❤lots of love

  • @harie8035
    @harie8035 2 ปีที่แล้ว

    Thank you from the core

  • @hetanhawke1695
    @hetanhawke1695 5 ปีที่แล้ว +4

    u r the best

  • @sujaymallick2202
    @sujaymallick2202 3 ปีที่แล้ว

    Elaboration is really lucid !

  • @bhawnasingh926
    @bhawnasingh926 4 ปีที่แล้ว +2

    Finally got it !!!!!......Thanks

  • @abhishekm1903
    @abhishekm1903 3 ปีที่แล้ว +1

    Excellent Work

  • @anrukshrajput
    @anrukshrajput 2 ปีที่แล้ว

    The video was interesting and easy to understand, I want to know how to get access to second and third element of array directly.

  • @stevewilsonraj
    @stevewilsonraj 3 ปีที่แล้ว +1

    the best explanation !

  • @JKA-sf7ll
    @JKA-sf7ll 3 ปีที่แล้ว

    &a is address of entire array
    a is address of 1st element of array

  • @mohankrishna2875
    @mohankrishna2875 2 ปีที่แล้ว

    Very nice explanation sir 🙂

  • @asmakhan541
    @asmakhan541 4 ปีที่แล้ว +3

    ThAnk u thanku thank u thank u sirrrrrr thousands time thank u from pak

  • @funnyanimation888
    @funnyanimation888 3 ปีที่แล้ว +1

    This s real education

  • @What_I_Make
    @What_I_Make 5 ปีที่แล้ว +2

    Good understanding regarding the zones, now all I need to do is understand why do it.

  • @mhj.xd7
    @mhj.xd7 ปีที่แล้ว

    short and clear

  • @manthanparekh6490
    @manthanparekh6490 10 หลายเดือนก่อน

    Please also explain for 2D array

  • @aladdinxd3902
    @aladdinxd3902 3 ปีที่แล้ว +1

    3 din se dimag ghumgaya❤️

  • @Aabara_ka_dabara
    @Aabara_ka_dabara ปีที่แล้ว

    informative lecture....

  • @shreyasingh222
    @shreyasingh222 3 ปีที่แล้ว

    thanks for this useful video.....

  • @animeshsrivastava5067
    @animeshsrivastava5067 4 หลายเดือนก่อน

    int (*p)[5] = a; should be done , instead of using &a

  • @nileshpokale862
    @nileshpokale862 3 ปีที่แล้ว

    Enemy down. All cleared.

  • @satyamsharma5181
    @satyamsharma5181 4 ปีที่แล้ว +1

    Sir can u make a separate video on how to pass the entire array to any function and to return it back to main()
    And how to declare these type of array

  • @ganeshraj541
    @ganeshraj541 2 ปีที่แล้ว

    why we are not same ampersand in two-dimensional array?
    For example:
    in one d array:
    (*p)[5]=&a;
    but in two d
    (*p)[5]=a;
    what is the difference?

  • @mehulshah9027
    @mehulshah9027 4 ปีที่แล้ว +4

    how to print other elements ???

    • @SerhatAtes
      @SerhatAtes 3 ปีที่แล้ว +1

      *(*p + 1) -> print the second element of the given array

    • @pradhanan9413
      @pradhanan9413 3 ปีที่แล้ว

      @@SerhatAtes correct

  • @akshaycharjan6384
    @akshaycharjan6384 3 ปีที่แล้ว

    Thank You Sir :)

  • @AdityaBharti23BRS119
    @AdityaBharti23BRS119 9 หลายเดือนก่อน

    how can we use sizeof() function to get the size of "the whole array" using this "pointer that points the whole array"?
    I was trying to get length of array by somehow getting the sizeof("the whole array pointer")/sizeof(array[0])
    can we do so without using for loops?

  • @compilerrun5516
    @compilerrun5516 4 ปีที่แล้ว +3

    When the address of first element and the whole array is same then why do we need to put "&a" instead of "a" ?

    • @anhminhnguyen4522
      @anhminhnguyen4522 4 ปีที่แล้ว +3

      Because by default "a" is the pointer to only the first element (or sub-dimensional array) of the "a" array not the whole array itself, this shall have further implications when we move on to more advanced C techniques. That's why we use "&a" instead. If you stick with his intuition regarding the operation of "*" and "&" operator you can interpret "&a" as "coming out of the first element's memory block to get the general address of the whole array"

    • @revanthvarma2000
      @revanthvarma2000 3 ปีที่แล้ว

      @@anhminhnguyen4522 Thanks for the clarification

    • @emmanuelandre2807
      @emmanuelandre2807 2 ปีที่แล้ว

      @@anhminhnguyen4522 hey can you give us an example when this occur that the adress "a" and "&a" are note the same

    • @suniel007
      @suniel007 2 ปีที่แล้ว

      @@anhminhnguyen4522 But a and &a both have same address.

  • @tayyab.sheikh
    @tayyab.sheikh 11 หลายเดือนก่อน

    Amazing ❤

  • @user-vn9ld2ce1s
    @user-vn9ld2ce1s 2 ปีที่แล้ว

    Well, someone should've told us this a long time ago...

  • @anjalirajeev1054
    @anjalirajeev1054 3 ปีที่แล้ว +1

    Thank u 💯💯💯💯

  • @MohamedMagdy-pt5zo
    @MohamedMagdy-pt5zo 4 ปีที่แล้ว

    Thx for your help

  • @hetaeramancer
    @hetaeramancer 2 ปีที่แล้ว +1

    what if i've written *p[6] or *p[4] for that matter? whereas the array has 5 elements.

    • @tomaszstanislawski457
      @tomaszstanislawski457 2 ปีที่แล้ว

      it would not compile because `int[6]` and `int[5]` are not compatible types

  • @indian3451
    @indian3451 5 ปีที่แล้ว

    Plz make a video on DMA

  • @Thetejano1987
    @Thetejano1987 5 ปีที่แล้ว

    I understand the concept of it and how to use it but I do not understand why it is must be declared as int (*p)[5]. Can you please explain?

  • @lakshanchamod1208
    @lakshanchamod1208 ปีที่แล้ว

    woow sir thanks

  • @tejastej2762
    @tejastej2762 3 ปีที่แล้ว

    Superb

  • @qandos-nour
    @qandos-nour 4 ปีที่แล้ว

    thank you

  • @devToumeh
    @devToumeh 3 ปีที่แล้ว

    thx but how to call the second value ?? withoud adding ++ i mean *p[1]

  • @kells137
    @kells137 ปีที่แล้ว

    without you I wont graduate

  • @ase6817
    @ase6817 8 หลายเดือนก่อน

    why can we just leave out the & and write int*p=a instead of int*=&a or int*p=&a[0]

  • @adityaraje7015
    @adityaraje7015 2 ปีที่แล้ว

    Can pointer be stored in array if yes please give me syntax

  • @nickolaisimmons4638
    @nickolaisimmons4638 3 ปีที่แล้ว

    First 57 seconds better at explaining that most other videos lol

  • @adityasaxena6619
    @adityasaxena6619 5 ปีที่แล้ว +4

    int a[5] ={1,2,3,4,5};
    int (*p)[5]= &a;
    int (*p)[5] =a;
    if we replace line 2 by line 3 still output remains same.Why so??

    • @krishnachaitanyareddygujju2823
      @krishnachaitanyareddygujju2823 4 ปีที่แล้ว +14

      &a : address of whole array
      a : address of the first element of the given 1-d array; this can also be written as &(*a)
      coming to your question; in this context a and &a are equal because when we store address we store the base address here base address of a and &a are same.
      but however ; a and &a are very different.

    • @whenthethebeansstrikeback6728
      @whenthethebeansstrikeback6728 4 ปีที่แล้ว

      @@krishnachaitanyareddygujju2823 Makes sense

    • @SerhatAtes
      @SerhatAtes 3 ปีที่แล้ว

      @@krishnachaitanyareddygujju2823 very well explained

  • @EverythingTechWithMustafa
    @EverythingTechWithMustafa 5 ปีที่แล้ว +1

    Sir notes plzz

  • @mca_waala
    @mca_waala ปีที่แล้ว

    Nice

  • @shabeerkhan379
    @shabeerkhan379 5 ปีที่แล้ว

    Suppose the length of array contains 10 elements.is it possible to point a pointer only 5 elements in those array??

    • @AjeetKumar-he9lk
      @AjeetKumar-he9lk 5 ปีที่แล้ว +4

      No, if you have got an 1D array of 10 elements. By putting * and &, we are transitioning dimensions (shown as boxes) and not half or full of an array.
      But also...
      Yes, if you talk about a 2D array of 10 elements (i.e. two 1D array of size 5). For that:
      int a[2][5];
      int (*p)[2][5]=&a; // &a is for whole array
      So,
      p is pointer to whole array
      *p is pointer to 1st 1D array which is of 5 elements (voila, got it!)

    • @behindthescene4406
      @behindthescene4406 3 ปีที่แล้ว

      @@AjeetKumar-he9lk bro I didn't get how &a is pointed pointed by (*p)[5] ...I mean how 5 elements pointing to &a ....they must be individually pointed by array of pointers ...plz some clear tis doubt

  • @swapnilprantamistry
    @swapnilprantamistry 3 ปีที่แล้ว

    Hi there, what will happen for these statements?
    int arr[5] = { 1, 2, 3, 4, 5 };
    int *ptr = arr;
    for(int i=0; i

    • @harmankaur3938
      @harmankaur3938 2 ปีที่แล้ว

      here *ptr is pointer of first element of the array 'arr'
      so according to the for loop condition, ptr means the pointer (containing the address of element) will get pre incremented and post incremented, and after that the value will be contained. thankyou

  • @syedyousufhussain2725
    @syedyousufhussain2725 3 ปีที่แล้ว

    what if i want to print second element of array

  • @adolfocarrillo248
    @adolfocarrillo248 4 ปีที่แล้ว

    So "a" is equal to a pointer to an integer because "*(&a)" is the same as "a" right?

  • @Hiyori___
    @Hiyori___ 3 ปีที่แล้ว

    ok so if we do printf( "%p", p ); and printf( "%p",*p ); we get the same result as an hexadecimal value because it's an address

  • @DaiMoscv
    @DaiMoscv 2 ปีที่แล้ว

    Think outside of the box 🤣

  • @shampabhattacharya5125
    @shampabhattacharya5125 4 ปีที่แล้ว +1

    Who r the dislikers ? 🖕

  • @andistheinforitbutso7513
    @andistheinforitbutso7513 2 ปีที่แล้ว

    Ssalute

  • @dineshchintu9779
    @dineshchintu9779 3 ปีที่แล้ว +2

    :)

  • @rede_neural
    @rede_neural 2 ปีที่แล้ว

    This is crazy lol

  • @sashah1454
    @sashah1454 2 ปีที่แล้ว

    what

  • @vigneshsvicky2110
    @vigneshsvicky2110 3 ปีที่แล้ว

    :-)

  • @mehulgour5417
    @mehulgour5417 3 ปีที่แล้ว

    :)