This code is pretty self-explanatory. its supposed to read in a character and write the next character as its output. However i seem to be getting NOT that effect. The code from the book compiles and runs fine and i swear mine is the same but it works differently.Code:/* ch7listing7.2. getchar() */
#include <stdio.h>
#define space ' '
int main(void){
char ch;
while ((ch=getchar()) !='\n'){
if (ch == space){
putchar(ch);
}
else
putchar(ch + 1);
ch = getchar();
}
putchar(ch);
return 0;
}