Quantcast
Viewing latest article 1
Browse Latest Browse All 2

Answer by klutt for how to create each word of input to start a new line

You should REALLY start enabling compiler warnings. They can help you find many bugs. Look here when I compile with -Wall and -Wextra.

$ gcc ba.c -Wall -Wextra
ba.c: In function ‘main’:
ba.c:13:5: warning: this ‘while’ clause does not guard... [-Wmisleading-indentation]
     while (nextChar != '\n' && nextChar != EOF);
     ^~~~~
ba.c:14:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘while’
     {
     ^

Remove the ; after the while loop.

But there are other problems too. As you can see from when I corrected the indentation for you, the return 0 statement is inside the while loop. I assume that's not what you want.


Viewing latest article 1
Browse Latest Browse All 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>