We saw in lecture that array parameters are actually pointer

We saw in lecture that array parameters are actually. pointer parameters, which are passably value and thus copied. However, we get behavior that makes it seem like the \"whole array\" was passed by reference and not copied. Briefly explain this:

Solution

We know, each variable we created has an address in memory. While we create the array, base address of array is stored in the name of an array i.e., if we have statement like this:

int a[10];

then a will have base address of array a.

So, when pass the array name, we are actually passing the address of the array. And change in the value of array values in the function reflects in the main function as well. For e.g., follow the given url

http://ideone.com/9siZyx

So, it seems like it is giving functionality like call by refernce.

Hope it helps. Please do give your response.

 We saw in lecture that array parameters are actually. pointer parameters, which are passably value and thus copied. However, we get behavior that makes it seem

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site