Skip to content
Related Articles

Related Articles

C | Advanced Pointer | Question 10
  • Difficulty Level : Medium
  • Last Updated : 08 Feb, 2014

Output of following program

#include <stdio.h>
int fun(int arr[]) {
   arr = arr+1; 
   printf("%d ", arr[0]);
int main(void) {
   int arr[2] = {10, 20};
   printf("%d", arr[0]);
   return 0;

(A) Compiler Error
(B) 20 10
(C) 20 20
(D) 10 10

Answer: (B)

Explanation: In C, array parameters are treated as pointers (See for details).

So the variable arr represents an array in main(), but a pointer in fun().

Quiz of this Question

Attention reader! Don’t stop learning now. Get hold of all the important C++ Foundation and STL concepts with the C++ Foundation and STL courses at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Recommended Articles
Page :