Define C datatype?
Datatype is used to specify and allocate memory for variables. Datatype size is differ from machine to machine. C supports int, float, char and double datatypes. limits.h has all size range details for datatypes.
|
Define C variables?
Variable is an identifier or user specified name stores a data value. Constant variables are unchanged during program execution.
|
Datatype details
Datatype Usage Memory size Limits
int stores rounded decimal values 2 bytes 32, 768 to 32, 767
float stores decimal values 4 bytes 3.4e-38 to 3.4e+38
char stores a character 1 byte -128 to 127
double stores high ranges of decimal values 8 bytes 1.7e-308 to 1.7e+308
|
Variable declration Syntax
Datatype [variable name 1],[variable name 2]...[variable name n];
Usage
int a,b,c;
Datatype variable-name = initial-value;
Usage
int a = 10;
|
#include
void main(){
int a,b,c;
a = 10;
b = 20;
c = a + b;
printf("C=%d",c);
}
|