Node:Declarations, Next:Initialization, Previous:Integer variables, Up:Variables and declarations
To declare a variable, write the type followed by a list of variables of
that type:
type_name variable_name_1, ..., variable_name_n;
For example:
int last_year, cur_year; long double earth_mass, mars_mass, venus_mass; unsigned int num_pets; long city_pop, state_pop; state_pop = city_pop = 5000000; short moon_landing = 1969; float temp1, temp2, temp3; temp1 = 98.6; temp2 = 98.7; temp3 = 98.5; double bignum, smallnum; bignum = 2.36e208; smallnum = 3.2e-300;
Always declare your variables. A compiler will catch a missing declaration every time and terminate compilation, complaining bitterly. (You will often see a host of error messages, one for each use of the undeclared variable. See Debugging.)