@ souravsain
Don't understand your solution.
if u type convert to char how u can say that msb is in higher memory address?
i think (char) will alway give the value of the lsb.
How u r checking endian ness?

normal endian ness check program
main()
{
int i=1;
char *p=(char*)&i;
if(*p==1)
printf("Small endian");
else
printf("Big endian");
}

Here suppose int is of 2 byets.
so content at the memory location of i will be

00000000  00000001
(MSB)        (LSB)         in Big endian machine

00000001  00000000
(LSB)        (MSB)         in small endian machine

as after pointing to the 1st memory location by *p we r checking if
the value is 1 or not.
if it is 1 then small endian or else big endian.


@Minotauraus
if u r creating pointer u r creating variable .

On 6/14/10, Minotauraus <anike...@gmail.com> wrote:
> How about a pointer? :D
>
> On Jun 13, 5:56 am, debajyotisarma <sarma.debajy...@gmail.com> 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 algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> 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 algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to