Why does this work when I used ( int c[ ] ) in function parameters? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why does this work when I used ( int c[ ] ) in function parameters?

https://code.sololearn.com/cMdYnCmPorsQ/?ref=app Here I passed getarr(2,a) as arguments, and in function parameters I used void getarr(int n,int c[ ] ) instead of (int* c[ ] ). Why does this work? Isn't passing a in getarr(2,a) the pointer to the address of the first element? If that were the case isn't it supposed to be (int* c[ ] ). Someone please explain, I'm confused.

16th Jul 2021, 2:51 PM
Srinath
1 Answer
0
「HAPPY TO HELP」 ohh thanks, i get it now. I always get confused with pointers and arrays. Gotta keep this in mind I guess, a=&a; *a=a[ ]
16th Jul 2021, 3:22 PM
Srinath