before I ask this question I have already debugged it for hours and read similar question post but I still cannot solve this problem. I checked that the error occurs when I define void drop(int size, int x_coor, int y_coor, int grid) this method.How to fix this error?
This is the error:
main.c:11: error: ',' expected (got "10")
#include <stdio.h>
#include <stdlib.h>
const int max_height = 4;
int height;
#define size 10
int grid[size][size];
void drop(int size, int x_coor, int y_coor, int grid);
int is_stable(int grid[size][size]);
void display(int grid[size][size]);
/*
Function to print out the 23*23 grid with given number of piles
*/
void create_InitialGrid(int total_param, char *piles[])
{
int i, j, k, assigned;
for (i = 0; i < size; i++)
{
for (j = 0; j < size; j++)
{
for (k = 1; k < total_param; k = k + 3)
{
if ((atoi(piles[k]) == i) && (atoi(piles[k + 1]) == j))
{
height = atoi(piles[k + 2]);
grid[i][j] = height; //store value into 2D array
assigned = 1;
break;
}
else
{
assigned = 0;
}
}
if (assigned != 1)
{
height = 0;
grid[i][j] = height;
}
}
}
}
//Simulate a grain of sand is dropped onto the center pile of the pane
void drop(int size, int x_coor, int y_coor, int grid)
{
.........
}
/*
Display the 2D array
*/
void display(int grid[size][size])
{
int i, j;
for (i = 0; i < size; i++)
{
for (j = 0; j < size; j++)
{
printf("%d", grid[i][j]);
}
printf("\n");
}
}
int main(int argc, char *argv[])
{
create_InitialGrid(argc, argv);
printf("Initial Grid: \n");
display(grid);
printf("////////////////////// \n");
drop();
display(grid);
return 0;
}