Examveda

What happens if the following program is compiled in both C and C++?
#include<stdio.h>
struct STRUCT
{
  int static a;
};
int main()
{
  struct STRUCT s;
  return 0;
}

A. The program runs fine and both prints output "HELLO THIS IS STRUCTURE"

B. The program gives an error in case of C but runs perfectly in case of C++

C. The program gives an error in case of C++ but runs perfectly in case of C

D. The program gives an error in case of both C and C++

Answer: Option B


Join The Discussion

Related Questions on Introduction to C plus plus