What is the difference between big endian form and little
endian form? write a code to convert big endian form to
little endian and vice versa..
Answer Posted / raj
Little Endian ->LSB at lower address
Big Endian -> MSB at lower address
e.g:
if the value is 0x0A0B0C0D then
in case of LE storage will be
Address 1000 0D
Address 1001 0C
Address 1002 0B
Address 1003 0A
in case of BE storage will be
Address 1000 0A
Address 1001 0B
Address 1002 0C
Address 1003 0D
Marco to convert(this will convert from LE to BE or BE to
LE--> one for all :) )
#define CON(NUM) (NUM&0x000000FF)<<24|(NUM&0x0000FF00)<<8
|NUM&0x00FF0000)>>8 |(NUM&0xFF000000)>>24
| Is This Answer Correct ? | 17 Yes | 3 No |
Post New Answer View All Answers
Is there any possibility to create customized header file with c programming language?
What is typedef?
What is variable in c example?
Explain what is a 'null pointer assignment' error? Explain what are bus errors, memory faults, and core dumps?
What is masking?
Why can't I perform arithmetic on a void* pointer?
Do you know the difference between malloc() and calloc() function?
provide an example of the Group by clause, when would you use this clause
Why is c fast?
What are the c keywords?
Explain what is the benefit of using an enum rather than a #define constant?
What is void main () in c?
What standard functions are available to manipulate strings?
What is boolean in c?
Why is c known as a mother language?