Data
types:- C language is rich in
its datatype. The variety of data type available in C allows the
programmer to select the appropriate type according to the need of application.
ANSI C supports four classes of datatypes.
- Primary/ Fundamental data type:- The data type which represents the fundamental data i.e. characters and numbers and are already defined to the compiler is known as primary datatype. Integers, characters and float are primary data types in C language. Some of these datatype are further divided into different categories like signed, unsigned, short, long etc. The following chart represents the classification of basic datatype and their size, symbol.
- Derived datatype:- The datatypes which are derived from primary datatypes are called datatype. array, pointer, structure, union, function etc are derived datatype. Example :- int a[11]; int *ptr;
- User defined datatype: There are two ways to create user defined datatype-
example: 1) typedef int x;
2) typedef unsigned long int uli;
b) Using enum statement :- In addition to typedef statement C allows another user defined datatype enumerated datatype which can be created using enum keyword
syntax : enum datatype_name {value1, value2..................value n};
example : 1) enum days {Sunday, Monday, Tuesday,............Saturday};
2) enum months {January, ................. December};
4. Empty data set :- void, NULL, \0 are three members of empty data set.
1 Comments