Pointer Pointing to an Entire Array

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 ม.ค. 2025

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

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

    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

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

    NESO Academy, I can't stop loving you guys

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

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

  • @santiagomunez1347
    @santiagomunez1347 หลายเดือนก่อน +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.

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

    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

  • @azubuikedanielezeadim4019
    @azubuikedanielezeadim4019 3 ปีที่แล้ว +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

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

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

  • @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❤️

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

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

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

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

    Your visual explanation is so helpful, keep it up!

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

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

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

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

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

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

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

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

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

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

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

    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);

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

    what a superb explanation i love it

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

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

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

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

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

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

    Great explanation...

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

    These c series is simply exceptional & mind blowing

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

    Great Explanation

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

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

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

    u r the best

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

    Thank you. This helped me understand arrays.

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

    good explanation and thank you🤝

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

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

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

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

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

    the best explanation !

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

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

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

    because of you guys i got addicted with C❤️

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

    Excellent Work

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

    it helped me to understand that concept @4.14

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

    Thank you from the core

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

    Elaboration is really lucid !

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

    Very nice explanation sir 🙂

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

    informative lecture....

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

    Thank u 💯💯💯💯

  • @tayyab.sheikh
    @tayyab.sheikh ปีที่แล้ว

    Amazing ❤

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

    This s real education

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

    thanks for this useful video.....

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

    short and clear

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

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

    3 din se dimag ghumgaya❤️

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

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

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

    Thank You Sir :)

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

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

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

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

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

    Enemy down. All cleared.

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

    Thx for your help

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

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

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

    Please also explain for 2D array

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

    woow sir thanks

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

    Superb

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

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

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

    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 ปีที่แล้ว +5

      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 4 ปีที่แล้ว

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

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

    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?

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

    thank you

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

    Plz make a video on DMA

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

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

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

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

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

    without you I wont graduate

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

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

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

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

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

    First 57 seconds better at explaining that most other videos lol

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

    Nice

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

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

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

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

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

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

    Sir notes plzz

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

    what if i want to print second element of array

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

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

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

    Think outside of the box 🤣

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

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

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

    Who r the dislikers ? 🖕

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

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

    Ssalute

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

    :)

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

    This is crazy lol

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

    what

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

    :-)

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

    :)