Print every character in a line if it's greater than 80 characters How can I improve this program?

#include &lt;stdio.h&gt;
#define MIN 80

int main(void)
{
    char line[MIN];
    int i, c;

    for (i = 0; (c = getchar()) != EOF &amp;&amp; c != '\n'; ++i)
    {
        if (i &lt; MIN - 1)
            line[i] = c;
        else
        {
            if (i == MIN - 1)
                printf("%s", line);

            printf("%c", c);
        }

    }

    return 0;
}
A few notes (overall very good for a beginner):


Change MIN so that it's a static const because it respects scope and is type-safe.  Also, what is it the minimum for?  The variable name could be more specific.
Very nice on the int main(void)!
Always initialize your variables when you declare them.  This helps prevent unintended behavior later on in the program.
Declare i within your for loop, this should be standard by now (and has been as of C99).

for (int i = 0; ...)


You could also do this with your c variable, but I wouldn't recommend that as i is the counter that is tied directly to that for loop.
The rest of your for loop may be hard for some beginners to read, but I actually like it the way it is and don't find it too hard to read.
The way you have your if statement may be of concern to some.


if (i &lt; MIN - 1)
    line[i] = c;



Their argument is that it could lead to potential bugs in the future if maintained incorrectly.  I'm going to say it's fine, as long as you're consistent with it AND use GCC 6's -Wmisleading-indentation flag to help catch those problems with it in the future
You don't append \0 to line when you are about to print it.

if (i == MIN - 1)
{
    line[i] = '\0';
    printf("%s", line);
}

You don't have to return 0 at the end of main(), just like you wouldn't bother putting return; at the end of a void-returning function. The C standard  knows how frequently this is used, and lets you not bother.


  C99 &amp; C11 §5.1.2.2(3)
  
  ...reaching the } that terminates the main() function returns a
  value of 0.





Final code:

#include &lt;stdio.h&gt;

static const int MIN_LENGTH = 80;

int main(void)
{
    char line[MIN_LENGTH];
    int c = 0;

    for (int i = 0; (c = getchar()) != EOF &amp;&amp; c != '\n'; ++i)
    {
        if (i &lt; MIN_LENGTH - 1) line[i] = c;
        else
        {
            if (i == MIN_LENGTH- 1)
            {
                line[i] = '\0';
                printf("%s", line);
            }

            printf("%c", c);
        }
    }
}