This question already has an answer here:
- Dividing 1/n always returns 0.0 2 answers
Why the output of x in the programming is 0 instead of 1/2?
#include <stdio.h>
#include <stdlib.h>
int main()
{
double *xp,x;
xp = &x;
*xp = 1/2;
printf("%fn",x);
return 0;
}
give the result of
0.000000
Aucun commentaire:
Enregistrer un commentaire