C variable
Description
A variable is a place to hold a value in the program.
Example
The following code shows how to define variables.
int main()/* w ww .ja v a 2 s . c o m*/
{
int variable;
int variable_2;
int variable_3;
variable = 3 * 5;
variable_2 = 2 * variable;
variable_3 = 3 * variable;
return (0);
}
Example
We can put variable definition into one line for the variables with the same type.
#include <stdio.h>
//from w w w . j a va2 s . c om
int main()
{
int m,y,d;
m = 1;
y = 2;
d = 3;
printf(" %d %d %d \n",m, y, d);
return 0;
}
The code above generates the following result.