if i am having a following structure
if i am giving value asCode:struct emp { int acc; char name; }; struct emp e;
what the above statement mean. can anyone explain me...Code:e.acc|=ACC_NO;
thanks in advance...
This is a discussion on giving value to structure elements within the C Programming forums, part of the General Programming Boards category; if i am having a following structure Code: struct emp { int acc; char name; }; struct emp e; if ...
if i am having a following structure
if i am giving value asCode:struct emp { int acc; char name; }; struct emp e;
what the above statement mean. can anyone explain me...Code:e.acc|=ACC_NO;
thanks in advance...
The last line of code shows the dot operator, which is used to access the parts of the struct. Note that "char name" is not an array of char's, but only a single char. To make it longer, you need to make it a char array - char name[40], for example.
Remember that a bunch of char's is not a string, in C. No matter how many there are of them. They are elevated to a string ONLY when they have an End of String marker char, placed as their last value: '\0'.
So: "Frederick" is not a string, but "Frederick\0" is one.
ya, you are right. But, i need help for the second statement in assigning values for structure elements. what's that "or(|)" symbol comes here.
It's used to set specific bits in a variable. Typically used to combine several flags into one variable.
One flag sets bit 1, the next bit 2, and so on.
See it as
SetBit(e.acc, ACC_NO);
For information on how to enable C++11 on your compiler, look here.
よく聞くがいい!私は天才だからね! ^_^