C Programming - Arrays - Discussion

Discussion Forum : Arrays - Yes / No Questions (Q.No. 3)
3.
Is there any difference int the following declarations?
int fun(int arr[]);
int fun(int arr[2]);
Yes
No
Answer: Option
Explanation:

No, both the statements are same. It is the prototype for the function fun() that accepts one integer array as an parameter and returns an integer value.

Discussion:
14 comments Page 2 of 2.

Niyati said:   1 decade ago
I am satisfied with Arun,in 1st function declaration there is no specification of the size of array it accepts i.e. it can take an array of any size, but in second function declaration there is size of array specified so it can accept the array of atmost size 2,then How can these two statements be same

Rahul said:   1 decade ago
According to Comments given by @Bhavesh and @Arun how is it possible that both are same statements,bcoz the size is different for array in the declarations.

Arun said:   1 decade ago
You can pass an array of any size in d first one, where as in the 2nd one you can atmost pass an array of size 2.

Bhavesh said:   1 decade ago
The first statement signifies that any number of elements are possible in the array ?


Post your comments here:

Your comments will be displayed after verification.