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


Please Help Members By Posting Answers For Below Questions

What is this pointer in c plus plus?

590


Find MAXIMUM of three distinct integers using a single C statement

622


What are structural members?

566


Can math operations be performed on a void pointer?

583


How to write a code for implementing my own printf() and scanf().... Please hep me in this... I need a guidance... Can you give an coding for c... Please also explain about the header files used other than #include...

4900






Disadvantages of C language.

651


Explain setjmp()?

651


How can I open a file so that other programs can update it at the same time?

655


The % symbol has a special use in a printf statement. Explain how would you place this character as part of the output on the screen?

656


What are global variables and explain how do you declare them?

569


What is a 'null pointer assignment' error?

722


Are pointers integers in c?

606


Is it fine to write void main () or main () in c?

543


What is the ANSI C Standard?

775


What is the use of f in c?

553