Expand|Select|Wrap|Line Numbers
- level0.c: In function ‘create_grid’:
- level0.c:28:9: warning: return from incompatible pointer type [-Wincompatible-pointer-types]
- return grid;
The code for the function is:
Expand|Select|Wrap|Line Numbers
- struct gridType* create_grid(int length){
- char** array = malloc(length * sizeof(*array));
- for(int i = 0; i < length; i++){
- array[i] = malloc(length * sizeof(array));
- }
- for(int i = 0; i < length; i++){
- for (int j = 0; j < length; j++){
- array[i][j] = '-';
- }
- }
- struct gridType{
- int length;
- char** array;
- };
- struct gridType* grid = malloc(sizeof(struct gridType));
- grid->length = length;
- grid->array = array;
- return grid;
- }