We all know that while executing a program, they store their data in memory. Memory can assumed as a large array of bytes.
The endianness of the machine indicates in which order the data gets stored in the memory.
Please refer this and this link for a detailed introduction to this topic.
Here is the simple C++ program to check if a machine is little endian or big endian.
In the following program integer is stored in 4 bytes. We take a character pointer and point it to the integer address by type casting the address of x.
Here is the simple C++ program to check if a machine is little endian or big endian.
In the following program integer is stored in 4 bytes. We take a character pointer and point it to the integer address by type casting the address of x.
Read full article from Problem solving with programming: Write a program to check the endianness (Big endian or little endian) of the machine
No comments:
Post a Comment