|
-
May 1st, 2004, 09:53 AM
#2
Are you trying to convert a number in a character string to a float, or just a character to a float?
If it's just a character (as your question suggests), you can cast it as follows:
char MyChar = 'A';
float MyFloat = (float)MyChar;
printf("MyFloat = %.2f\n", MyFloat);
Which should give something like:
MyFloat = 65.00
Hope this helps,
- Nigel
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|