Here are two programs, in the first program i get d=0 as my answer in the statement, in the second program i get the correct answer d=7. Why does an incorrect answer appear in the statement when I am using the double command?
In my google search something came up about doubles not being allowed for use in statements, but I couldn't find any other information on the topic. Thanks in advance for your responses.
Code:
#include <stdio.h>
int main (void)
{
int a = 3, b = 4;
double d;
d = a + b;
printf ("The value of d is %d\n", d);
return (0);
}
Code:
#include <stdio.h>
int main (void)
{
int a = 3, b = 4, d;
d = a + b;
printf ("The value of d is %d\n", d);
return (0);
}