I am new to C programming, i am currently working on a program where i must accept keyboard input and reproduce the text after eliminating white space. unless the text is in a string literal, then it must be reproduced with spaces. i have the first part (printing without spaces) but im not quite sure how to make it print normally within string literals....can anyone help me? here is my code
Code:
#include <stdio.h>
int main()
{
int c;
printf("This program eliminates whitespace from an input stream,\n");
printf("except from within string literals in double quotes.\n");
printf("\n");
printf("Type characters, and enter EOF after <enter> to finish:\n");
while ((c = getchar()) != EOF)
if ( c != ' ')
putchar(c);
system("pause");
return 0;
}