| | |
Problem in Pointers!!
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Oct 2009
Posts: 1
Reputation:
Solved Threads: 0
Hi all!
Please somebody explain me how this snippet is working!!
Please somebody explain me how this snippet is working!!
C Syntax (Toggle Plain Text)
main() { float a 4.379; char*p; int i; p=(char*)&a; for(i=1;i<=3;i++) printf("%02X",(unsigned char)p[i]); }
0
#2 Oct 24th, 2009
•
•
•
•
Hi all!
Please somebody explain me how this snippet is working!!
C Syntax (Toggle Plain Text)
main() { float a 4.379; char*p; int i; p=(char*)&a; for(i=1;i<=3;i++) printf("%02X",(unsigned char)p[i]); }
Last edited by gerard4143; Oct 24th, 2009 at 8:20 pm.
0
#4 Oct 25th, 2009
function to display the floating number
the float numbers are stored in sign exponent mantissa fashion
furthur reading
http://steve.hollasch.net/cgindex/coding/ieeefloat.html
void test()
{
float f=5.25;
char *p=(char *)&f;
int i;
for(i = 3; i >= 0; i-- )
printf("%x\n",p[i]);
}
refer the attachment for out put on my system .
the float numbers are stored in sign exponent mantissa fashion
furthur reading
http://steve.hollasch.net/cgindex/coding/ieeefloat.html
void test()
{
float f=5.25;
char *p=(char *)&f;
int i;
for(i = 3; i >= 0; i-- )
printf("%x\n",p[i]);
}
refer the attachment for out put on my system .
Minds are like parachutes - they only work when they are open
Gaiety
Gaiety
![]() |
Similar Threads
- Problem with pointers (C)
- The Problem with Pointers (C++)
- swapping with pointers ... (C)
- Problem with pointers (C++)
- Converting Struct to class lost with pointers (C++)
- Problem About Pointers (C++)
Other Threads in the C Forum
- Previous Thread: Turbo C
- Next Thread: Reading few string from a .txt file
| Thread Tools | Search this Thread |






