Why are arrays always passed as pointer as the argument when a function is called? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why are arrays always passed as pointer as the argument when a function is called?

18th Jul 2019, 2:44 PM
Vivek Singh Dhakad
Vivek Singh Dhakad - avatar
2 Answers
+ 1
Simply because it's impossible to pass all members or objects in array into a function Note: an array type variable is actually a pointer itself, so if you write something like int arr[ ] as parameter or variable, it's actually a pointer
18th Jul 2019, 2:49 PM
Agent_I
Agent_I - avatar
+ 1
Ok I got it... thanks
18th Jul 2019, 2:58 PM
Vivek Singh Dhakad
Vivek Singh Dhakad - avatar