Skip to content
Related Articles

Related Articles

C | Misc | Question 8
  • Last Updated : 04 Sep, 2015

Output of Below C Code? Assume that int takes 4 bytes.




#include<stdio.h>
int x = 5;
int main()
{
    int arr[x];
    static int x = 0;
    x = sizeof(arr);
    printf("%d", x<<2);
    return 0;
}

Thanks to Gokul Kumar for contributing this question.
(A) Compiler error in line “static int x = 0”
(B) 7
(C) 80
(D) 20


Answer: (C)

Explanation: Size of gives size of arr * int in bytes = 20
Left shift two times gives you 80.

Quiz of this Question

Want to learn from the best curated videos and practice problems, check out the C Foundation Course for Basic to Advanced C.
My Personal Notes arrow_drop_up
Recommended Articles
Page :