What will be the output of the program? [code] extern int var; int main(void) { var = 10; var++; cout<<var; } [/code]

Lượng Tiger

New member
What will be the output of the program?
Code:
extern int var;
int main(void)
{
  var = 10;
  var++;
  cout<<var;
}
A. 10
B. 11
C. Run time error
D. Compile time error
 
Answer: d
Explanation: The program gives the compiler time error. There is no definition given for the extern variables. This is not allowed and hence we get a compile time error.
 

Tìm kiếm

Back
Top