Hi guys,
I am working with a 2D array in C for the first time. I have the following syntax error 4 times in code:
Here is part of the code (I don't want to post all of it because it is a HW assignment)Code:Syntax error before ']' token
I just need to know how to fix the syntax errors. Thanks in advance to anyone who helps me out.Code:#include <stdio.h> #include <stdlib.h> #include <stdbool.h> //Declare Global Constants #define ROWS 3 #define COLS 3 //Declare Functions bool getInput(int* inpt); void generateBoard(int inpt, int board [][COLS]); void printBoard(int board [] [COLS]); bool isValid(int board [] [COLS]); bool isWinner (int board [][COLS], int* winpat, int* winsum); void printWinner(int board [][COLS], int winpat, int winsum); int main (void) { //Declare Local Variables int inpt, winpat, winsum = 0; int board [2][2]; bool isGdInpt, isBrdVld, isAWinner; //Call fuctions FILE *fpIn, *fpOut; isGdInpt = getInput(&inpt); if(isGdInpt) { generateBoard(inpt, board [][]); isBrdVld = isValid(board [][]); if(isBrdVld) { isAWinner = isWinner(board[][], &winpat, &winsum); if(isAWinner) printWinner(board [][], winpat, winsum); else fprintf(fpOut, "There is no winner this round."); } fclose(fpOut); } else printf("\n\n"); //End program return 0; }![]()



LinkBack URL
About LinkBacks



