sorry its 32 bit no. not 323..wrote tht by mistake

On Thu, Jul 21, 2011 at 1:57 PM, Anika Jain <anika.jai...@gmail.com> wrote:

> @piyush: lets say 323 bit integer given is the one with its binary as
> 00001110 00011000 01000001 00110011 then output shall be 14.24.65.51
> both for little as well as big endian..
>
>
> On Thu, Jul 21, 2011 at 1:28 PM, sagar pareek <sagarpar...@gmail.com>wrote:
>
>> @anika
>> first divide ur 32 bits in four octets
>> then convert them in integers and save in 4 int variables
>>
>> now to find us system is little or big endian:-
>> so u can do this as:-
>>
>> #include<stdio.h>
>>
>> union endian
>> {
>>  int a; //assuming int to be 2 bytes
>>  char [2];
>> };
>>
>> main()
>> {
>>  union a ={1};
>>
>>  if(a.char[0]==1)
>>   printf("Little endian\n");
>>
>>  else
>>  printf("big endian\n");
>>
>> }
>>
>> On Thu, Jul 21, 2011 at 3:53 AM, Piyush Sinha 
>> <ecstasy.piy...@gmail.com>wrote:
>>
>>> @Anika..can u give one example??
>>>
>>> On 7/21/11, Anika Jain <anika.jai...@gmail.com> wrote:
>>> > write a c code that takes a 32 bit ip address n prints it in dotted
>>> notation
>>> > as a.b.c.d.
>>> > The code shall work for big endian as well as for little endian..
>>> >
>>> >
>>> > In this how can i make it common for big endian and little endian?? if
>>> in
>>> > little endian my lower order 8 bits shall be d but for big endian they
>>> shall
>>> > be a..
>>> >
>>> > --
>>> > You received this message because you are subscribed to the Google
>>> Groups
>>> > "Algorithm Geeks" group.
>>> > To post to this group, send email to algogeeks@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.
>>> >
>>> >
>>>
>>>
>>> --
>>> *Piyush Sinha*
>>> *IIIT, Allahabad*
>>> *+91-7483122727*
>>> * <https://www.facebook.com/profile.php?id=100000655377926> "NEVER SAY
>>> NEVER"
>>> *
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@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.
>>>
>>>
>>
>>
>> --
>> **Regards
>> SAGAR PAREEK
>> COMPUTER SCIENCE AND ENGINEERING
>> NIT ALLAHABAD
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@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 algogeeks@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