What does mean in the following C program Also why did th
What does != \'\ \' mean in the following C program?
Also, why did the program include 2 functions instead of 1? Meaning: they should have removed void wrt_it(void) and include everything in int main(void).
/* Write a line backwards. */
#include <stdio.h>
void wrt_it(void);
int main(void) {
printf(\"Input a line: \");
wrt_it();
return 0;
}
void wrt_it(void)
int c;
if ((c = getchar()) != \'\ \')
wrt_it();
putchar(c); }
Solution
!=\'\ \' implies dont take new line input for variabe c (i.e write all characters on a single line until new line character is inserted).
There is separate function to ensure modularity (i.e wrt_it() can be called no of times we want to insert new line ..instead if we place its code in main then we can insert only one line...
