Re: How to determine the way data is stored in memory?



Abhishek wrote:
can you please explain how can this program validate such an
assumption?
Can you please lean to quote - how can someone explain a program if you don't quote it?

The header provides a number of C99 typdefs for exact and inexact integer types, specifying the size in bits. So a uint32_t is a 32 bit unsigned int.

The program simply assigns 1 to a 32 bit int and tests to see if the first byte is 1, if so, you have a little endian machine.

Ian

--
Ian Collins.
.