Good evening. Why do I get the error with the ternary operator?
if I writeCode:#define FOLD 40 int getLine(char* s, int lim) { int i; char c; for(i = 0; i < lim - 1 && (c = getchar()) != EOF && c != '\n'; i++) (i % FOLD == 0)? s[i] = '\n' : s[i] = c; if(c == '\n') s[i++] = c; s[i] = '\0'; return i; }
I don't get the error. Why?Code:if(i % FOLD == 0) s[i] = '\n'; else s[i] = c;