A programmer must use appropriate data type as for his requirement.
C supports 3 category of data types;
- Primary or Fundemental Data Types
- User Defined Data Types
- Derived Data Types
They are integer data type, floating point data type, character data type.
Integer data types represents whole numbers.
Floating point data types represents real numbers(Float supports 6 digit, Double supports 14 digit precision).
Character represents a single character.
Void is used as return type of a function, which doesn't return any value.
2. User Defined Data Types :
C allows users to define their own data types.
User defined data types are created from promary data types.
tyoedef is the identifier, which is used to create such data types.
General syntax : typedef type identifier;
For example : typedef int score;
Score speed, accuracy;
3. Derived Data Types :
These are derived from standard data types by adding additional features to it.
Some examples:
Arrays and strings, stuructures, unions