hi george...may b this will work

#include<stdio.h>
void main()
{
short a;
char *b;
a=0x3031;
b=(char*)&a;
printf("%c",*b);
}

a short int occupies 2 byte of memory.so lets assume a
occupies address 1000 and 1001.when u say
a-0x3031

if the processor is like intel processor (little or
big i donn remember) it will get stored as
1000th loc contains 0x31
1001th loc contains 0x30

so we wnat to know what byte stored in the starting
address of 'a'.inorder to do this we use a char
pointer to point to the strting address of a.so when
we acess the value at b we only get the byte stored at
starting address of a..so if it prints 1(0x31 is the
ascii value of charecter '1') its like intel
processor..if it prints '0 then its
not................regarda MAX



--- George Joseph <[EMAIL PROTECTED]> wrote:

> Hi All,
>  
>    Can anyone of you tell me how to find endianness
> of a processor.I want to write a C function to find
> the endianness of a processor?The C Code should work
> on any compiler/environment.Thanks In
> Advance.stbtechie.
>  
>  
> 
>               
> ---------------------------------
> Do you Yahoo!?
> Yahoo! Mail Address AutoComplete - You start. We
finish.



                
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com





------------------------ Yahoo! Groups Sponsor --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/EbFolB/TM
--------------------------------------------------------------------~-> 

To unsubscribe : [EMAIL PROTECTED]

 
Yahoo! Groups Links

<*> To reply to this message, go to:
    http://groups.yahoo.com/group/Programmers-Town/post?act=reply&messageNum=3628
    Please do not reply to this message via email. More information here:
    http://help.yahoo.com/help/us/groups/messages/messages-23.html

<*> To visit your group on the web, go to:  
    http://groups.yahoo.com/group/Programmers-Town/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to