Skip to content
Related Articles

Related Articles

C Quiz – 108 | Question 5
  • Difficulty Level : Easy
  • Last Updated : 17 Oct, 2015
GeeksforGeeks - Summer Carnival Banner

In a C file (say sourcefile1.c), an array is defined as follows. Here, we don’t need to mention arrary arr size explicitly in [] because the size would be determined by the number of elements used in the initialization.




int arr[] = {1,2,3,4,5};

In another C file (say sourcefile2.c), the same array is declared for usage as follows:




extern int arr[];

In sourcefile2.c, we can use sizeof() on arr to find out the actual size of arr.
(A) TRUE
(B) FALSE


Answer: (B)

Explanation: First thing first, sizeof() operator works at compile time. So usage of sizeof on arr in sourcefile2.c won’t work because arr in sourcefile2.c is an incomplete type. Please note that arr in sourcefile1.c is a complete type because size of array got determined at compile time due to initialization.

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 :