C Data Types
Data types specify how we enter data into our c programs and what type of data we can enter in it. C language has some predefined set of data types to handle various kinds of data that we use in our c program. C data types have different storage capacities and meaning.
Different type of data types in C Language.
- Primary data types : These are fundamental data types in C namely integer(int), floating(float), charater(char) and void.
- Derived data types : Derived data types are like arrays, functions, stuctures and pointers.
Now Elaborate Primary C Data Types, these are as follows:
Primary data types
There are five basic data types associated with variables:
- int – integer: a whole number.
- float – floating point value: ie a number with a fractional part.
- double – a double-precision floating point value.
- char – a single character.
- void – valueless special purpose type which we will examine closely in later sections.
Derived Data Types
- Function : A function type describes a function that returns a value of a specified type.
- Arrays : An array is a container for data which is of all the same type. The type can be a basic type or a derived type. A C array is defined by using the square brackets
- Pointers : The basic concept is that a pointer provides a mechanism for determining the address of data.
- Structure : A structure type is a sequentially allocated nonempty set of objects, called members.Union
- Union : A union type can store objects of different types at the same location in memory.
Important Points to remember in C Data Types :
- Identify the type of a variable when it declared.
- Identify the type of the return value of a function.
- Identify the type of a parameter expected by a function.
Go to Next >> Basics of C Language