I'm trying to build a tic tac toe in c. I have to ask the user to choose the dimensions ( 3 * 3 / 4 * 4 / ..) the problem is that it keeps showing me that there is something wrong.. here is my code:
#include <stdio.h>
#include <stdlib.h>
void printBoard(char** board, int size)
{
int i,j;
printf("\n");
for(i=0;i<size;i )
{
for(j=0;j<size;j )
{
printf("[%c] ",board[i][j]);
}
printf("\n");
}
}
int main()
{
int i,j,size;
printf("Enter the dimensions of the board: ");
scanf("%d %d",&i,&j);
if (i != j)
{
printf("Input error!");
return 0;
}
if (i == j)
{
char **board;
board = malloc(i*sizeof(char*));
for(int c=0; c < i; c )
{
board[c] = malloc(c*sizeof(char));
}
size = i = j;
printBoard(char **board,int size); /// Expected expression - what's wrong?
}
}
CodePudding user response:
-- printBoard(char **board,int size); /// Expected expression - what's wrong?
printBoard(board,size); /// Fixed