Initialising Variables in C Programming Language

You can assign an initial value to a variable when you declare it. For example:

int i=1;

sets the int variable to one as soon as it's created. This is just the same as:

int i;

i=l;

but the compiler may be able to speed up the operation if you initialise the variable as part of its declaration. Don't assume that an uninitialised variable has a sensible value stored in it. Some C compilers store 0 in newly created numeric variables but nothing in the C language compels them to do so.

Variable names:
  1. should be lowercase for local variables
  2. should be UPPERCASE for symbolic constants (to be discussed later)
  3. only the first 31 characters of a variables name are significant
  4. must begin with a letter or _ (under score) character


Learn More :