wonder if someone can offer an explanation.
I wrote a program, very basic as I'm still learning. The program read
5 values into an array and added them together finishing by printing the result
as shown below. On first run I input 1-5 expecting the answer 15, the value it
returned was very different indeed.
printf("The sum total is %d",sum);
after lots of head scratching I tried a space between %d and " this cured
The next day I wrote another program to read in a value and cube it. The
program just hangs after the input of the variable x until another number/character
is entered, however, the output is as it should be. This time the problem was
cured by removing the space either side or the %d in the scanf statement.
printf("Please enter the number");
scanf(" %d ",&x);
y = x*x*x;
printf("The cube is %d ",y);
Finally to the point, all the texts I've read say "C ignores white space",
is this a problem with the compiler (Bloodshed Dev++) or is it just part of the
syntax that needs to be considered.