Solution for Exercise 5-9
ex0509
#include <stdio.h> int main() { printf("The total is %d\n",16.0+17); return(0); }
Notes
* The compiler reads value 16.0 as a float because of the .0 part. The value 17 is still assumed to be an int.
* The result I saw on one of my test computers was:
* The value isn't random. Instead, it's the printf() function trying to interpret what's become a floating point value as an int thanks to %d
.
Copyright © 1997-2024 by QPBC.
All rights reserved