Identifying C

Just as we need variables to do interesting mathematics, we need them to write interesting programs too. Let's look at a simple example:

   int i, j ;

   i = 5 ;
   j = 3 ;
   printf( "sum = %d, product = %d\n", i + j, i * j ) ;

Even this simple program illustrates a number of facets of variables and their uses:
  1. Each variable has a type. In this example the variables are declared to be of type int which stands for integer. That is these variables may only hold whole numbers and not fractions. Other variable types include float (for numbers with fractional parts) and char (for holding single characters such as digits, letters and punctuation).
  2. More than one variable may be declared in the same statement.
  3. Variables have names, i and j in this example. Unlike mathematics, we normally use much longer variable names such as num_stud for the number of students at some point in the program. C allows only certain variable names (identifiers):
    1. An identifier may be composed of letters, digits or the underscore character (_).
    2. An identifier must start with a letter or an underscore.

Which ones of these are valid variable declarations in C?

int num_stud ;
int num students ;
integer 5options ;
float five_options, IsStudent ;
char position_5 ;