I'm getting errors with the following switch case statement.
I'm getting the following error:Code:/*switch (command_read) { case command_list[0]: { printf("Hello\n"); } case command_list[1]: { printf("NHL\n"); } case command_list[2]: { printf("NFL\n"); } case command_list[3]: { printf("Kingston\n"); } case command_list[4]: { printf("Eraser\n"); } }*/
I'm not entirely sure about what's wrong with the implementation using the array indices. Any help would be much appreciated.--------------------Configuration: IO - Win32 Debug--------------------
Compiling...
IO.CPP
G:\Current Courses\EECE 314\projects\el_with_synchronization\IO\IO.CPP(71) : error C2051: case expression not constant
G:\Current Courses\EECE 314\projects\el_with_synchronization\IO\IO.CPP(73) : error C2051: case expression not constant
G:\Current Courses\EECE 314\projects\el_with_synchronization\IO\IO.CPP(75) : error C2051: case expression not constant
G:\Current Courses\EECE 314\projects\el_with_synchronization\IO\IO.CPP(77) : error C2051: case expression not constant
G:\Current Courses\EECE 314\projects\el_with_synchronization\IO\IO.CPP(79) : error C2051: case expression not constant
G:\Current Courses\EECE 314\projects\el_with_synchronization\IO\IO.CPP(81) : warning C4060: switch statement contains no 'case' or 'default' labels
Error executing cl.exe.
IO.exe - 5 error(s), 1 warning(s)



LinkBack URL
About LinkBacks



