Tic Tac Toe in C - Version 1 This was the first game I made not too long ago (2018), and while I'm working on another, more complex version, I want to know how good or bad I did this one and what can be improved.

Note: the change of players and detection of free spaces are the things I did with help of a friend, everything else I did it myself.

#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;stdbool.h&gt;

int printBoard();
int clear(int h, int w);
int freeSpace();
int player();
int checkLine(int x, int y, int z);
int winner();

int player_input;
char board[9] = {' ', ' ', ' ',
                 ' ', ' ', ' ',
                 ' ', ' ', ' '};

int player_num = 1;
char symbol = 'X';

int main(void)
{
    char start;

    clear(24, 80);

    printf("\nTotito game on a 3x3 board:\n");
    printf("Enter number from 1 to 9 to mark the respective spaces in the board.\n");
    printf("Press a number to start the game: ");
    scanf("%c", &amp;start);

    clear(24, 80);
    printBoard();

    while (true)
    {
        player();
        clear(24, 80);
        printBoard();
        winner();

        player_num = (player_num == 1)? 2: 1;
        symbol = (player_num == 1)? 'X': 'O';
    }
}

int printBoard() // 3x3 board
{
    int lines = 7;
    int columns = 7;
    int n = 0;

    for (int i = 1; i &lt;= lines; i++)
    {
        printf("    ");

        for (int j = 0; j &lt; columns; j++)
        {
            if (i % 2 != 0)
            {
                if (j % 2 == 0)
                {
                    printf("+");
                }

                else
                {
                    printf("---");
                }
            }

            else
            {
                if (j % 2 == 0)
                {
                    printf("|");
                }

                else
                {
                    printf(" %c ", board[n]);
                    n++;
                }
            }
        }

        printf("\n");
    }
}

int clear(int h, int w)
{
    printf("\033[0;0H");

    for (int i = 0; i &lt; w; i++)
    {
        for (int j = 0; j &lt; h; j++)
        {
            printf(" ");
        }
    }

    printf("\033[0;0H");
}

int freeSpace()
{
    for (int i = 0; i &lt; sizeof(board); i++)
    {
        if (board[i] == ' ')
        {
            return true;
        }
    }
}

int player()
{
    printf("Player %d: ", player_num);

    if (freeSpace())
    {
        scanf("%d", &amp;player_input);
    }

    while (board[player_input - 1] != ' ')
    {
        printf("\033[1APlayer %d: Not empty, try again: ", player_num);
        scanf("%d", &amp;player_input);
    }

    board[player_input - 1] = symbol;
}

int checkLine(int x, int y, int z)
{
    if ((board[x] == symbol) &amp;&amp; (board[x] == board[y]) &amp;&amp; (board[y] == board[z]))
    {
        printf("Player %d wins!\n", player_num);
        exit(0);
    }
}

int winner()
{
    checkLine(0, 1, 2); //first horizontal

    checkLine(3, 4, 5); //second horizontal

    checkLine(6, 7, 8); //third horizontal

    checkLine(0, 3, 6); //first vertical

    checkLine(1, 4, 7); //second vertical

    checkLine(2, 5, 8); //third vertical

    checkLine(0, 4, 8); //first diagonal

    checkLine(2, 4, 6); //second diagonal
}
Compiler Options and Warning Checking
It might be a good idea to use the -wall compiler switch. It will provide warning messages that may indicate possible logic errors in some cases. When compiled with -wall this program yields the following warning messages:

D:\ProjectsNfwsi\CodeReview\tictactoev1\main.c(89) : warning C4716: 'printBoard': must return a value
D:\ProjectsNfwsi\CodeReview\tictactoev1\main.c(104) : warning C4716: 'clear': must return a value
D:\ProjectsNfwsi\CodeReview\tictactoev1\main.c(115) : warning C4715: 'freeSpace': not all control paths return a value
D:\ProjectsNfwsi\CodeReview\tictactoev1\main.c(133) : warning C4716: 'player': must return a value
D:\ProjectsNfwsi\CodeReview\tictactoev1\main.c(142) : warning C4715: 'checkLine': not all control paths return a value
D:\ProjectsNfwsi\CodeReview\tictactoev1\main.c(161) : warning C4716: 'winner': must return a value

In some cases the functions should be declared void rather than int, in other cases there might be a bug when not all control paths return a value, this is certainly true in freeSpace.
Global Variables
Global variables make programs very, very difficult to write, read, debug and maintain. In the C programming language they can cause modules (other .c files) not link if the global variable is declared in multiple modules. Due to the nature of global variables, it is sometimes very difficult to find where they are changed in order to remove a bug.
There is a discussion about global variables in this stackoverflow question
It is much better to pass a variables into functions where they are needed.
Avoid Using exit()
For a number of reasons the use of the exit() function should be avoided. The exit() function should be used when there is a non-recoverable error in a program. Since it is not being used for this purpose in this program it should definitely be avoided. It would be much better if the functions checkLine() and winner() returned values that indicated status.