Hi all, I'm quite new to C programming, so forgive me if I've made silly mistakes. I'm tryin to write a program to remove the extra spaces between words.
So far, I'm only able to remove all spaces, and I had a problem with the output of my program. The program would print funny characters at the end of the output. I would greatly appreciate if anyone could point out to me what is wrong, and how I could further implement my code to meet my objectives. (like the above example). Thank you!
Input: C Programming is fun.
Output: C Programming is fun.
When I run my program, I get
int i=0, j=0;
printf("Input = ");
fgets(input, 50, stdin);
else if(!isspace(input[i]) && input[i]!='\0')
output[j] = input[i];
Input = there is a
Output = thereisa(funny characters here)