when initialize a sturcture, its different between c and c++.
for example:
struct Student
{
int id;
int age;
char *name;
};
const int def_id = 999;
const int def_age = 18;
struct Student stud =
{
def_id,
def_age,
"jackson"
};
the code can not be compiled in c but can be compiled in c++.
Reason:
In c, only constant value can be used to initialize a structure.
but in c, only Micor and Enum is constant value. const just means the value of the variable can not be changed , but the variable is not constant.