@saurav: your code will always print 2 irrespective of the system's
endianness!

correct thing to do is:
printf("%d", *(char *) (0x00000002))

--Sundeep.

On Mon, Jun 14, 2010 at 3:02 AM, Minotauraus <[email protected]> wrote:

> How about a pointer? :D
>
> On Jun 13, 5:56 am, debajyotisarma <[email protected]> wrote:
> > Is it possible to check endianness of a system in C without creating
> > variable?
> >  i.e. Program should not contain any variable.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<algogeeks%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to