I am having lot of problems with my C code. I am saving data into my array with this function:
/**
* Insert Data into array
* @param char[] pointer
*/
void insertData(char **data) {
int i;
for (i = 0; i < 2; i++) {
data[i] = malloc(10000);
printf("Nombre del paciente %d: ", i+1);
scanf("%s", &data[i][0]);
printf("Habitacion: ");
scanf("%s", &data[i][1]);
printf("Cama: ");
scanf("%s", &data[i][2]);
free(*data);
}
}
My variable data is : char data[2][3];
And I'm trying to show this data with the next function:
void mostrarResultados(char **data) {
int i,j;
for (i = 0; i < 2; i++) {
printf("\n");
for (j = 0; j < 3; j++) {
printf("%c ", data[i,j], **data);
}
}
}
But the console return me weird characters:

What am I doing wrong?
To these functions I am calling them this way:
//First menu
do{
switch (option){
case 1:
insertData(data);
setFirstTime(false);
mostrarResultados(data);
break;
case 2:
exit(0);
break;
}
} while (option == 0);
}
Thank you very much for your help!