G
Gestorm
Hi everyone, I have a problem. If I declare a struct with a const
member, what will happen?For example:
if I declared a struct like following:
struct{
const int a;
char c;
}aStruct;
then such statement as
aStruct.a = 0;
is illegal.
But I can printf the value of a, it's always the same value no matter
how many times I recompile the program. I'm wondering about how can
the compiler ascertain the value of the const member?
In an application, I wanna define a struct, whose first member is a
const and its value is given by me, how can I do that? Neither K&R
book nor "C: A Reference manual" mention this problem. Does anyone
know? Thanx ^_^
member, what will happen?For example:
if I declared a struct like following:
struct{
const int a;
char c;
}aStruct;
then such statement as
aStruct.a = 0;
is illegal.
But I can printf the value of a, it's always the same value no matter
how many times I recompile the program. I'm wondering about how can
the compiler ascertain the value of the const member?
In an application, I wanna define a struct, whose first member is a
const and its value is given by me, how can I do that? Neither K&R
book nor "C: A Reference manual" mention this problem. Does anyone
know? Thanx ^_^