CP CVDT Q22

  • Option : D
  • Explanation : The declaration extern int i; tells the compiler that the integer variable i is defined elsewhere. However, no actual definition of i is present in the given program. Assigning i = 20 requires the variable to exist, so the linker normally reports an undefined reference to i. Therefore, the intended answer is D (Error). Additionally, main should be declared as int main(void) in modern C, and sizeof returns size_t, which should be printed using %zu rather than %d.
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *