See below.

On Mon, 15 Jun 1998, Andrea Arcangeli wrote:

> 
> You could write also:
> 
> void main(void)
> {
>         float r = '0';
>         printf("%f\n", r);
> }
> 
> And '0' will be casted to float and it will print 48.000... as expected.
> 
> Andrea[s] Arcangeli
> 
> 
        Yes, C has been fixed so that it works almost in spite of the
programmer. Depends on which compiler you use. 

        But defining r to be float and then initializing it as char will
give un-expected results. It is bad code and is only good if it does what
you want it too...:-)

        I think here in the C programmer sig we should try to use only
clear programing examples. Not litter the thing with trivial code that
works but is not supposed to.



Best wishes 

   - Karl F. Larsen, 3310 East Street, Las Cruces,NM (505) 524-3303  -

Reply via email to