I am new to C programming and also to these boards. I started learning C on my own and I have a small question about the specifier to use for double data types. In the following small code I expected that the last printf statement should display 2.5 but instead i am getting 0.000000. Can someone tell me what I am doing wrong?
Also when using the float data type is it true that when assigning a value it should include a suffix f the value as otherwise it will be automatically converted to double?
int number = 0;
double number2 = 2.5;
printf("The int variable \"number\" has %d bytes\n", sizeof(number));
printf("The double variable \"number2\" has %d bytes\n", sizeof(number2));
(double)number = number2;