Reputation: 382
I have a specific set of constraints. The problem wouldn't be difficult if it wasn't for the constraints.
#define ROW 12
#define COL 6
int main (void)
{
// Code can be changed in brackets
char arr[ROW][COL];
function1(arr);
printf("%s", arr[0][0]);
}
void function1(char arr[][COL]){ //Can't change anything in this line
// Code allowed to be changed inside brackets
// Trying to assign values to multi-dim array as shown below
arr[0][0] = 'O';
}
Process finished with exit code -1073741819 (0xC0000005)
Upvotes: 0
Views: 45
Reputation: 1728
change arr[0][0] = "O";
to arr[0][0] = 'O';
Specify the proper format in printf("%s", arr[0][0]); //<-----should be %c
#define ROW 12
#define COL 6
int main (void)
{
// Code can be changed in brackets
char arr[ROW][COL];
function1(arr);
printf("%c", arr[0][0]); //<----------- should be %c
}
void function1(char arr[][COL]){ //Can't change anything in this line
// Code allowed to be changed inside brackets
// Trying to assign values to multi-dim array as shown below
arr[0][0] = 'O';
}
Upvotes: 2