C | Pointer Basics | Question 17
(A) 10 20 30 40
(B) Machine Dependent
(C) 10 20
Explanation: In C, array parameters are always treated as pointers. So following two statements have the same meaning.
void fun(int arr) void fun(int *arr)
 is used to make it clear that the function expects an array, it doesn’t change anything though. People use it only for readability so that the reader is clear about the intended parameter type. The bottom line is, sizeof should never be used for array parameters, a separate parameter for array size (or length) should be passed to fun(). So, in the given program, arr_size contains ration of pointer size and integer size, this ration= is compiler dependent.
10 20 30 40
My Personal Notes arrow_drop_up
Please Login to comment...