I have written a simple program and stored it with .c file,
When i compiled it with g++ it is getting compiled and giving the proper output when i run that,
but when i compile the same using gcc then it is throwing error.
Below is the sample .c file
#include<stdio.h>
struct A{
private:
int a;
public:
int sum(){
a=10;
}
void print()
{
printf("%d\n",a);
}
A()
{
printf("Constructor\n");
}
A(int b)
{
printf("Copy Constructor\n");
}
~A()
{
printf("Destructor\n");
}
};
main()
{
struct A a(10);
a.sum();
a.print();
}