Mail Archives: djgpp/1999/03/28/22:21:46
ryan_brown AT my-dejanews DOT com wrote:
>
> How can I convert values from a variable of one type to another variable of a
> different type? I need to convert a float variable over to a char variable.
> In pascal there were functions for this in c I can't find anything. I have
> heard of casting but I can't get it to work and there isn't any documentation
> about it anywhere.
Casting *is* the way to accomplish such a task. Please post some code
that doesn't work for you.
If you're learning C, you ought to have a book or similar reference, and
that will explain casting.
> Someone also told me that you can't cast between float
> and char.
I don't think this is true. Admittedly, it's likely to overflow, but
that's a separate issue.
--
Nate Eldredge
nate AT cartsys DOT com
- Raw text -