16
Convertir un nombre flottant en entier
- #include <stdio.h>
- main() {
- const double pi = 22.0/7;
- printf( "pi = %f\n", pi );
- printf( "(int)pi = %d\n", (int)pi );
- }
$ gcc -o cast cast.c
$ ./cast
pi = 3.142857
(int)pi = 3
$ gcc -o cast cast.c
$ ./cast
pi = 3.142857
(int)pi = 3
Commentaires