MCQs > IT & Programming > Programming With C > An array is defined with the following statement in a file, file1.c int a[ ] = { 1, 2, 3, 4, 5, 6 }; In another file, file2.c, the following code snippet is written to use the array a: extern int a[]; int size = sizeof(a); What is wrong with the above code snippet?

Programming With C MCQs

An array is defined with the following statement in a file, file1.c

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

In another file, file2.c, the following code snippet is written to use the array a:
extern int a[];
int size = sizeof(a);
What is wrong with the above code snippet?

Answer

Correct Answer: An extern array of unspecified size is an incomplete type. The size of the operator during compile time is unable to learn the size of an array that is defined in another file

Explanation:

Note: This Question is unanswered, help us to find answer for this one

Programming With C Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

search

Programming With C Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it