
C Programming Data Type
Table of Contents
In this chapter you will learn about C programming data types and variable declaration methods.
The data type determines the type of data stored in the variable.
In C programming, variables of memory locations have to be declared before use. Similarly the function should be declared before use.
The size and type of data is usually determined by the variable and function declarations associated with the data type.
C Data Type
- Fundamental Data Type
- Integer Type
- Floating Type
- Character Type
- Derived Data Type
- Arrays
- Pointers
- Structures
- Enumeration
In this chapter we have focused more on basic data types. Visit our Derived Data Types section to learn more about Derived data types.
C Programming Char - Character Data Type
The char keyword is used to declare a variable of character type. For example:
char alphabet = 'a'
Here alphabet is character variable and value of alphabet is ‘a’.
Size of character variable is 1 byte.
C Programming int - Integer Data Type
All positive and negative integers except decimal (.) numbers fall into this type. Eg – 0, -10, 10 etc.
In C programming, the int keyword is used to declare a variable of integer type. For example:
int roll_no;
Here roll_no integer type variable.
In C programming you can declare many variables simultaneously with one declaration. For example:
int roll_no, age, years;
The size of an int can be 2 bytes or 4 bytes. If your variable is 4 bytes in size, it can take 2 to 32 distinct value. Eg- -2 31, -2 31 +1, …, -2, -1, 0, 1, 2, …, 2 31 -1
Similarly if the size of int variable is 2 bytes it can take 2 16 number of different values between-2 15 and 2 15 -1. If you want to store numbers greater than 2 31 -1 i.e +2147483647 and less than -2 31 i.e. -2147483648 then the program will not run properly.
C Programming Float - Floating Type
A Floating type variable can contain any real number. Eg- 3.1416, 10.0 etc. You can use either float or keyword to declare a variable of float type. double For example:
float accountBalance;
double bookPrice;
Here both accountBalance and bookPrice are floating type variables.
In C programming, floating values can also be represented in expontial form. for example:
float normalizationFactor = 22.442e2;
Difference Between float and double in C Programming

Let’s take a look at data types. Here data size is given based on 32 bit architecture.
Pingback: C Programming Modifier -