C | Arrays | Question 1

Predict the output of below program:

filter_none

edit
close

play_arrow

link
brightness_4
code

#include <stdio.h>
  
int main()
{
    int arr[5];
      
    // Assume that base address of arr is 2000 and size of integer
        // is 32 bit
    arr++;
    printf("%u", arr);
      
    return 0;
}

chevron_right


(A) 2002
(B) 2004
(C) 2020
(D) lvalue required


Answer: (D)

Explanation: Array name in C is implemented by a constant pointer. It is not possible to apply increment and decrement on constant types.

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Article Tags :
Practice Tags :


9


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.