Skip to main content

C Data types

Data is an most important of every programming language. That is a collection of text, number, floating point number. When we use those data in our program then first need to specified its type. this type is provide behaviour of variable such as data value, storage capacity etc. C programming are provide different variety of data type. and there are some limitation to store the amount of data. When we define a variables they are need to provide a data type. They are divided in following category.

C Data Types

Primitive data type :

1) char : char variable are stored only single character. there are basic data type of c programming. all c compiler are allocate memory of 1 bytes in char variable.

char variable_list;
Iteam Overview
char keyword
variable_list list of char variables
Scope When it defined. local char are inside of block, and global char are entire the program
Format specifier %c
2) int : int are store integer value. There are capable to store 2 bytes for 32 bit compiler ,and 4 bytes of 64 bit compiler. integer are declared in c programming as follows.

int variable_list;
Iteam Overview
int keyword
variable_list list of integer variables
scope When it defined. local integer are inside of block, and global integer are entire the program
Format specifier %d both signed and unsigned intger, %i for unsigned int.

For example.

 int age;

3) float : float are capable to store decimal floating point value with single precision.

float variable_list;
Iteam Overview
float keyword
variable_list list of floating variables
scope When it's defined. local float variable are inside of block, and global float are entire the program
Format specifier %f both signed and unsigned float

4) double: double are also store decimal value but there are capable to store double precision (floating point value).

double variable_list;
Iteam Overview
double keyword
variable_list list of double variables
scope When it's defined. local double variable are inside of block, and global double are entire the program
Format specifier %lf

5) void : void are empty data type. normally there are utilize in following place.

a) When function are not returning any values. for example.

  void print salary(int id){
  void display_result(){

b) when function are not accept any values. that is an optional to use void when function are not have parameter list.

  int message(void){
  void display(void){

c) there are utilized in pointer. for example.

    Example of void data type
//header file
#include <stdio.h>
// function declaration
void display(void);
int config(void);

void display(void){
    printf("Welcome to programming\n");
//in this case using of function argument
int config(void){
    return 1;
int main(){
   int status=config();
    void *ptr;
        display();// function call
        //assign address
        ptr=&status ;
        //print address of status variable
        printf("Value of ptr is : %p",ptr);
        //type cast and use
        printf("\nValue of *ptr is : %d",*((int*) ptr));


Welcome to programming
Value of ptr is : 0x7ffee35fd6bc
Value of *ptr is : 1

Sign qualifiers

integer and floating point variable is capable to stored both positive and negative values.

a) signed variable are storing both positive and negative values.

//32 bit compiler
signed char:  range  -128 to 127
signed int:  range  -2147483648 to 2147483647
signed short int:  range -32768 to 32767

b) unsigned are store only negative values

//32 bit compiler
Unsigned char:  from 0 to 255 
Unsigned int:  from 0 to 4294967295 
Unsigned short int:  from 0 to 65535  

Derived Data Types

Derived data type is combination of user defined data type like structure, union enumeration and arrays.


C array

array is an data structure there are used to combine group of elements. view Array Post.

Structure (struct)


Structure is a keyword, this are reliable to create user defined data type. for example array are store similar type of elements. similar way structure is capable to combine multiple different data in c programming. View Structure post.

Enumeration or (enum)


enum is keyword there is also called enumeration in c language. There can used to create user defined data type. they are consist of integer constant. view post Enumeration.


C Union

union is keyword of c programming language. there are use to defined the user data type. view post Union.


Please share your knowledge to improve code and content standard. Also submit your doubts, and test case. We improve by your feedback. We will try to resolve your query as soon as possible.

New Comment