Showing posts with label C Language. Show all posts
Showing posts with label C Language. Show all posts

C Language is Following Little Endian Method

How can We Prove that C Language (Microprocessor) is Following Little-Endian Method to Store Values?
[* For Intel x86/x86_64 Not for BM Power PC Thanks Josh for Comment]

void main()

{

int i=9;


char *p;

clrscr();


p = (char) &i ;

printf("\n First Byte : %d",*p);


p++;


printf("\n Second Byte : %d",*p);

getch();


}


You will Get Answer 

First Byte : 9

Second Byte : 0

It proves that C is using Little-Endian.