in this by typecasting address of float a to char * u assign the address of a to ptr. but as ptr is a character pointer when *ptr is printed only 1 byte currently pointed by ptr is pointed. when ptr is incremented it points to the next higher higher order byte of "a". by this way all bytes of "a" are printed using a character pointer
On Wed, Jun 13, 2012 at 11:47 PM, Rahul verma <[email protected]> wrote: > int main() > { > int i; > float a=5.2; > char *ptr; > ptr=(char *)&a; > for(i=0;i<=3;i++) > printf("%d ",*ptr++); > return 0; > } > give me explanation of this code..... > > -- > 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. > -- Regards Anika Jain -- 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.
