In little endian machine the least significant byte is stored in the lowest numbered memory address and the most significant byte in the highest address.

The figure shows the number 2030H. The 20 H is most significant byte and 30H is least significant byte. The Little endian machine will store 20 H in higher memory address and 30 H in lower memory address.

 

Motorola family of processor use big endian format, in which the least significant byte is stored in the higher numbered memory address and the most significant byte in the lower address.

Example in Programming:

In network programming there are APIs under The header

#include<arpa/inet.h>
uint32_t htonl(uint32_t hlo);

uint16_t htons(uint16_t hhor;

uint32_t ntohl(uint32_t nlo);

uint16_t ntohs(uint16_t nsh);

 

What is Little endian and big endian Machine

 

 

 

These functions shall convert 16-bit and 32-bit quantities between network   byte order and host byte order.On some implementations, these functions are defined as macros.The   uint32_tand uint16_types are    defined in <inttypes.h>.The htonl() and htons() functions shall return the argument value converted from host to network byte order.The ntohl() and ntohs() functions shall return the argument value converted from  network     to host byte order.



Related Contents to follow