int in c


What is int or integer data type in c programming language with examples?



Size of int data type depends upon which compiler we are using. Hence memory representation also varies according to the compilers. Before explaining the memory representation of int dada type I would like to one very important concept endianess of operation system.

Endianess of hardware:

    There are two types computer architecture on the basis of how it stores the data in the memory. Computer architecture may be big endian or little endian.

Big endian:


A computer has big endian architecture if it stores the data in memory in the following manner:




That is first of all first byte i.e. A will fill then second byte i.e. B will fill then third byte i.e. C and so on from right to left as shown in the above figure.

Little endian:

A computer has little endian architecture if it stores the data in memory in the following manner:



That is first of all last byte i.e. A will fill then second last byte i.e. B will fill then third last byte i.e. C and so on from right to left as shown in the above figure.

Note: Both Turbo c++ and LINUX gcc compiler are based on little endian computer architecture.

char
int
float 
double
void 
Data type tutorial home
C tutorial home.

No comments: