Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

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;
}

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;
}
Answer: b
Explanation: C does not allow the programmer to declare any static members inside a class whether in C++ it is allowed to declare static variables.

Join The Discussion