Good evening. Why do I get the error with the ternary operator?

Code:
#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; 
}
if I write

Code:
if(i % FOLD == 0) 
 s[i] = '\n'; 
else 
 s[i] = c;
I don't get the error. Why?