C ++ unfamiliar syntax when I try to learn data structures in C ++

I am going to learn Data Structures in C ++, but I suffer from appearance to unfamiliar C ++ syntax, for example:

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

To analyze the algorithm, which is implemented in the C ++ programming language, I come across a huge number of unfamiliar codes. Please help me fix this issue. Thanks to the stackoverflow community.

+4
source share
2 answers

It declares an array of enumstype SeatStatus. The array is called SeaList. This suggests that it enum SeatStatuswas previously defined.

This wording may look more familiar:

SeatStatus SeaList[Max_Seats];

, - , SeatStatus.

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
}
+8

enum enum -, C-.

, SeatStatus enum, .

+7

All Articles