Working on (what should be) a simple project, taking the input from stdin and reformatting it to match the output specs. I'm just wanting to see what the experts here think of the following function that is supposed to skip k chars up to the end of the line, unless k < 0, where it will keep skipping chars until it reaches newline.
1 #include <stdio.h>
25 int skip(int count){
26 int i;
27 int ch;
28
29 for(i = 0; count < 0 || i < count; i++){
30 ch = fgetc(stdin);
31 if(ch == EOF){
32 return -1;
33 }
34 if(ch == '\n'){
35 return 0;
36 }
37 }
38 return 1;
39 }
(including the line numbers for reference purposes)