C Language: Integer Variables
Which is an integer data type?
The INTEGER data type stores whole numbers that range from
-2,147,483,647 to 2,147,483,647 for 9 or 10 digits of precision. The number
2,147,483,648 is a reserved value and cannot be used. The INTEGER value is
stored as a signed binary integer and is typically used to store counts,
quantities, and so on.
There are the following integer types available in the C
Language:
- short int
- unsigned short int
- int
- unsigned int
- long int
- unsigned long int.
Syntax
The syntax for declaring integer variables is:
int variable_name1 [= value1];
Multiple integer variables is:
int variable_name1 [= value1] [, variable_name2 [= value2], ... variable_name_n [= value_n]];
#include <stdio.h>
{
int age;
printf("My age %d years old.\n", age);
return 0;
}
C program where we declare these two variables:
#include <stdio.h>
int main()
{
int age, reach;
age = 10;
studying = 4;
printf("My age %d years old and studying %dth std.\n",
age, study);
return 0;
}
0 Comments