GENERAL: MISSING TYPE-SPECIFIER DOES NOT GENERATE ERROR
Information in this article applies to:
I have declared some global variables as follows:
char var0 = 0; var1 = 1, var2 = 2, var3 = 3;
I typed a semicolon instead of a comma by mistake. The compiler did not generate an error and the variables were incorrectly initialized. Why?
By inserting a semicolon you have split your single variable declaration into two. The second being:
var1 = 1, var2 = 2, var3 = 3;
Because there is no type-specifer such as char then int is assumed. The variables are initialized correctly, but as ints.
Refer to section A8.2 Type Specifiers in The C Programming Language by Brian Kernighan and Dennis Ritchie.
Last Reviewed: Tuesday, July 19, 2005
of your data.