T/F:
An enum is a user-defined data type for integer constants.
True
Name one Bitwise Operation...
AND, OR, XOR, NOT
The default starting value for enum is...
0
**enums start at zero, much like how indexing with arrays works
The symbol '&' is used in what Bitwise operation?
AND
T/F: You can NOT assign two elements to have the same enumeration value.
enum day {sunday = 1, monday = 1, tuesday = 2,
wednesday = 3, thursday = 4, friday = 5, saturday = 6};
False
**This is totally fine and both elements will represent the same value
The symbol '|' is used in what Bitwise operator?
OR
T/F:
Enums can be declared in both the global and local scope.
True
The symbol '^' is used in what Bitwise operation?
XOR
What will print when this code runs?:
enum year{Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec};
int main(){ int i;
for (i=Jan; i<=Apr; i++)
printf("%d ", i+1);
return 0; }
1 2 3 4
What is the output of the following code?
int main()
{
// 5 in binary = 00000101
// 9 in binary = 00001001
unsigned char a = 5, b = 9;
printf("a|b = %d\n", a | b);
return(0);
}
a|b = 13
** 00000101 | 00001001 = 00001101 (13)