debasish deka wrote:
> > In C, a structure member may be of any type except function returning
> > some type, any incomplete type, any variably modified type, and void.
> > Hence storage class specifiers can break this rule.
> > No my friend,
> > What I wanted to know is that whether the member element of a
> > structure can be assigned static storage classes....but I think after
> > some ponderings I got my answer...its like this.....
> > " If an element is assigned static storage class, all its objects
> > should have that element as static which may not be desirable " -- its
> > just my self explaination ...
> > Kindly mention if my reasoning is not befitting
I think OP's question has been misunderstood as OP has not clearly
outlined his question.
I think his question is:
struct MyStruct
{
static int i; //is this allowed in C? Why would I want to do
anything like this? All my objects will have same value of "i", OMG!
};
To OP:
(1) I forgot my C, dont remember anymore, this is allowed in C++.
In C++: Not all storage specifiers are allowed in C++ though, you can
use "static", search MSDN for what's allowed and not.
If you want an answer in C, you have to wait for one of the C gurus to
answer you
(2) I think you need to get a better understanding of what is a Class
and Object in OOPS.
Looks to me like you are trying to learn C and OOPS together, bad idea.
Learn one thing at a time, ditch C and learn C++ if its feasible.
Cheers
Ananth