First of all I have no idea where to start but to get started anyway I did this and I have couple of questions ->

1- Why my printf is not working and what is the reason?

2- Except printf thing, am I going in the right way to implement this function?

void init(void)
int count = d*d - 1;
for (int i = 0; i < d; i ++)
    for ( int j = 0; j < d; j ++)
        board[i][j] = count;
        printf("%d\t", board[i][j]);

Your problem lies not so much in your code, but in understanding all of the code. Different sections of the code do different things.

The init() function is ONLY supposed to initialize the values in the board array. It isn't supposed to print anything.

The clear() function clears the screen in preparation for the draw() function.

The draw() function actually prints out the board.

The problem is that clear() is called immediately after init(). That means that anything you print is immediately removed. If you're trying to do diagnostic prints, you'll need to introduce something to slow things down, to pause the program or put it to sleep, before clear() comes along and erases it.

I would recommend that you spend a little time and study all of the code to understand how it interacts.

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .