I'm about to learn Data Structures in C++ but I'm suffering from facing to unfamiliar C++ syntax , like :
enum SeatStatus SeaList[Max_Seats];
all I know about using "enum" in C++ is like :
enum direction{up,right,down,left} ; // 0 , 1 , 2 , 3
For analyzing an algorithm that is implemented in C++ programming language , I face to a huge amount of unfamiliar codes. Please help me fix this matter out. Thanks to stackoverflow community .
It is declaring an array of enums
of type SeatStatus
. The array is named SeaList
. This presupposes enum SeatStatus
has been defined previously.
This formulation might look more familiar:
SeatStatus SeaList[Max_Seats];
It is handy in situations where there is something else called SeatStatus
. For example
enum SeatStatus { GOOD, BAD };
const int Max_Seats = 42;
int main()
{
int SeatStatus; // Oh-oh, another SeatStatus!
SeatStatus SeaList[Max_Seats]; // ERROR: SeatStatus is int object
enum SeatStatus SeaList[Max_Seats]; // OK, we mean the enum
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With