Why Ctrl-Z does not trigger EOF?

Why Ctrl+Z does not trigger the loop to finish on the following small program?

#include <stdio.h>

main()
{
    int c;
    while ((c = getchar()) != EOF)
    {
        //nothing 
    }

    return 0;
}

If I enter: test^ZEnter, it does not get out of the loop.

I found related questions around (here and here) but none to explain it for C (not C++) under Windows.

Note: I use Visual Studio 2015 PRE on a windows 8.1


Solution 1:

You need to hit Enter and then use ctrl+Z and then Enter again.

or, you may also use F6