I am having a problem with converting a int to at floating point number. It is my understanding that the converstion should be automatic, but an explicit cast does not help either. This example resultis in Y=0 being displayed. Any explanation would be most appreciated.
#include <stdio.h>
main() {
int x;
double y=1;
x=5;
y=x; //OR y=(double)x;
printf("Y=%d\n",y);
}
#include <stdio.h>
main() {
int x;
double y=1;
x=5;
y=x; //OR y=(double)x;
printf("Y=%d\n",y);
}