Mega Code Archive

 
Categories / C Tutorial / Language
 

How to declare a variable

A variable declaration serves three purposes: It defines the name of the variable. It defines the type of the variable (integer, real, character, etc.). It gives the programmer a description of the variable. int answer;     /* the result of our expression */ The keyword int tells C that this variable contains an integer value. The variable name is answer. The semicolon (;) marks the end of the statement. The comment is used to define this variable for the programmer.