typedef struct{INT Semid; int counter; Char str[max_string]; }my_block_t;int Main () {my_block_t mybt; Compile time error here?? Char str2[max_string]; There's nothing wrong here!! return 0;}
compiler different, the results of the compilation is also different, standard C does not support variable declaration declaration array size, but some fused C + + support variable declarations, but C + + is not recommended to write, the size of the array should be a constant, if you are not sure the size of the array is best or a vector, such as a container, the array is changed to Char str[8192], or it is set to a macro at the beginning define # define Max_string 8192 You can modify the array size as long as you modify this value, which is also a general method for writing code, which facilitates debugging of large code.
Why can't I specify the size of an array in a struct with a const int variable?