In the bellow example, I would like to change some of the characters of my 2D array using standard "array[x][y]" syntax, I have tried several syntax such has *(world[0][1]), ... but always getting error Syntax or segmentation fault.
char *map[] = { "12345\0",
"67890\0"
};
void change( char **world) {
world[0][1] = 'X'; // <-- I want to replace character 2 of line 1 (2) by char 'X'
}
void main() {
printf("line=%s\n",map[0]);
printf("char=%c\n",map[0][1]);
change(map);
printf("now line is =%s\n",map[0]);
}
resulting
$ ./a.out
line=12345
line=2
Segmentation fault
Thanks for your help