I have tried;
void *malloc(unsigned int);
struct deneme {
const int a = 15;
const int b = 16;
};
int main(int argc, const char *argv[])
{
struct
The Standard uses the const keyword as a weird hybrid between an lvalue qualifier and a storage class, but doesn't make clear which meaning is applicable to struct members.
If one has a structure s of type struct S with member m of type T, the construct s.foo takes an lvalue of type struct S and derives from it an lvalue of type T. If T contains a qualifier, that modifier will affect the lvalue thus produced.
The Standard certainly recognizes the possibility that code may take an lvalue which is not const-qualified, derive from that an lvalue that is const-qualified, derive from that one which--like the original--is not, and then use the latter lvalue to modify the object. What is unclear is whether the use of a const modifier on a struct member affects the underlying storage class of an object, or whether it would merely cause a const modifier to be applied to any lvalue formed using the member-access operator. I think the latter interpretation makes a lot more sense, since the former leads to many ambiguous and unworkable corner cases, but I don't think the Standard makes clear which interpretation is supposed to apply. Since all situations whose behavior would be defined under the former interpretation would be defined identically under the latter, I see no reason the authors of the Standard wouldn't have regarded the latter interpretation as superior, but they might have wanted to leave open the possibility that in some cases, on some implementations, the former interpretation might offer some advantage implementation the Committee hadn't foreseen.