Multi platform ASCII spinner in C
Using fflush is pretty much required as output would otherwise be buffered until a newline character is printed.

You could use counter as an index to a character array instead of a big clunky repetitive switch. If you have a char *spinner = "|/-\\";, spinner[0] will be "|", spinner[1] will be "/", etc.

char *spinner = "|/-\\"; printf("\b%c", spinner[counter]); is going to print the common backspace character and the correct "spinner symbol" for each value of counter.  The spinner variable does not need to be declared because it's a string literal: printf("%c", "|/-\\"[counter]); can be used instead.

Apart from the unnecessary switch, I'd say you have an excessive amount of blank lines. If they are used more scarcely, their relative effect will be greater. Readability becomes more important as the program gets bigger.

/*
 * Separated groups of code:
 * If there were empty lines between all statements, it would be
 * difficult to tell the groups apart.
 */

foo(bar-&gt;baz);
foo(bar-&gt;quux);

counter++;
counter %= 4;


Here's a modified version:

#ifdef _WIN32
    #include &lt;windows.h&gt;
    #define sleepThr(x) Sleep(x)
#else
    #include &lt;unistd.h&gt;
    #define sleepThr(x) usleep((x) * 1000)
#endif

#include &lt;stdio.h&gt;

#define INTERVAL 200

int main()
{
    int counter;
    while (1)
    {
        for (counter = 0; counter &lt; 4; counter++)
        {
            printf("\b%c", "|/-\\"[counter]);
            fflush(stdout);
            sleepThr(INTERVAL);
        }
    }

    return 0;
}