Keywords: A keyword is a reserved word. All keywords have fixed meaning that means we
cannot change. Keywords serve as basic building blocks for program statements. All keywords
must be written in lowercase. A list of 32 keywords in c language is given below:
auto break case char
const continue default do
double enum else extern
float for goto if
int long return register
signed short static sizeof
struct switch typedef union
unsigned void volatile while
Note: Keywords we cannot use it as a variable name, constant name etc.
Data Types/Types:
To store data the program must reserve space which is done using datatype. A datatype is a
keyword/predefined instruction used for allocating memory for data. A data type specifies
the type of data that a variable can store such as integer, floating, character etc . It used for
declaring/defining variables or functions of different types before to use in a program.
There are 4 types of data types in C language.
C PROGRAMMING Page 20
, Types Data Types
Basic Data Type int, char, float, double
Derived Data Type array, pointer, structure, union
Enumeration Data Type enum
Void Data Type void
Note: We call Basic or Primary data type.
The basic data types are integer-based and floating-point based. C language supports both signed
and unsigned literals. The memory size of basic data types may change according to 32 or 64 bit
operating system. Let‟s see the basic data types. Its size is given according to 32 bit
architecture.
Size and Ranges of Data Types with Type Qualifiers
Type Size (bytes) Range Control String
char or signed char 1 -128 to 127 %c
unsigned char 1 0 to 255 %c
C PROGRAMMING Page 21
, int or signed int 2 -32768 to 32767 %d or %i
unsigned int 2 0 to 65535 %u
short int or signed short 1 -128 to 127 %d or %i
int
unsigned short int 1 0 to 255 %d or %i
long int or signed long 4 -2147483648 to 2147483647 %ld
int
unsigned long int 4 0 to 4294967295 %lu
float 4 3.4E-38 to 3.4E+38 %f or %g
double 8 1.7E-308 to 1.7E+308 %lf
long double 10 3.4E-4932 to 1.1E+4932 %Lf
Variables
A variable is a name of memory location. It is used to store data. Variables are changeable,
we can change value of a variable during execution of a program. . It can be reused many
times.
Note: Variable are nothing but identifiers.
Rules to write variable names:
1. A variable name contains maximum of 30 characters/ Variable
name must be upto 8 characters.
2. A variable name includes alphabets and numbers, but it must start
with an alphabet.
3. It cannot accept any special characters, blank spaces except under
score( _ ).
4. It should not be a reserved word.
Ex : i rank1 MAX min Student_name
StudentName class_mark
C PROGRAMMING Page 22
cannot change. Keywords serve as basic building blocks for program statements. All keywords
must be written in lowercase. A list of 32 keywords in c language is given below:
auto break case char
const continue default do
double enum else extern
float for goto if
int long return register
signed short static sizeof
struct switch typedef union
unsigned void volatile while
Note: Keywords we cannot use it as a variable name, constant name etc.
Data Types/Types:
To store data the program must reserve space which is done using datatype. A datatype is a
keyword/predefined instruction used for allocating memory for data. A data type specifies
the type of data that a variable can store such as integer, floating, character etc . It used for
declaring/defining variables or functions of different types before to use in a program.
There are 4 types of data types in C language.
C PROGRAMMING Page 20
, Types Data Types
Basic Data Type int, char, float, double
Derived Data Type array, pointer, structure, union
Enumeration Data Type enum
Void Data Type void
Note: We call Basic or Primary data type.
The basic data types are integer-based and floating-point based. C language supports both signed
and unsigned literals. The memory size of basic data types may change according to 32 or 64 bit
operating system. Let‟s see the basic data types. Its size is given according to 32 bit
architecture.
Size and Ranges of Data Types with Type Qualifiers
Type Size (bytes) Range Control String
char or signed char 1 -128 to 127 %c
unsigned char 1 0 to 255 %c
C PROGRAMMING Page 21
, int or signed int 2 -32768 to 32767 %d or %i
unsigned int 2 0 to 65535 %u
short int or signed short 1 -128 to 127 %d or %i
int
unsigned short int 1 0 to 255 %d or %i
long int or signed long 4 -2147483648 to 2147483647 %ld
int
unsigned long int 4 0 to 4294967295 %lu
float 4 3.4E-38 to 3.4E+38 %f or %g
double 8 1.7E-308 to 1.7E+308 %lf
long double 10 3.4E-4932 to 1.1E+4932 %Lf
Variables
A variable is a name of memory location. It is used to store data. Variables are changeable,
we can change value of a variable during execution of a program. . It can be reused many
times.
Note: Variable are nothing but identifiers.
Rules to write variable names:
1. A variable name contains maximum of 30 characters/ Variable
name must be upto 8 characters.
2. A variable name includes alphabets and numbers, but it must start
with an alphabet.
3. It cannot accept any special characters, blank spaces except under
score( _ ).
4. It should not be a reserved word.
Ex : i rank1 MAX min Student_name
StudentName class_mark
C PROGRAMMING Page 22