How do I? I'm trying:
#include <stdio.h>
#include <stdlib.h>
int changeMap(char mp[], int x, int y){
mp[x-1][y-1] = 'X';
return 0;
}
int main(){
char map[][1] = "gabriel";
printf("%c", map[0][0]);
changeMap(map, 1, 1);
printf("%c", map[0][0]);
return 0;
}
You want to return:
t
X
But returns:
G:\PROJETOS\C\main.c||In function 'changeMap':|
G:\PROJETOS\C\main.c|4|error: subscripted value is neither array nor pointer nor vector|
G:\PROJETOS\C\main.c||In function 'main':|
G:\PROJETOS\C\main.c|8|error: invalid initializer|
G:\PROJETOS\C\main.c|10|warning: passing argument 1 of 'changeMap' from incompatible pointer type [enabled by default]|
G:\PROJETOS\C\main.c|3|note: expected 'char *' but argument is of type 'char (*)[1]'|
||=== Build failed: 2 error(s), 1 warning(s) (0 minute(s), 0 second(s)) ===|