I continue to crash in case 4 of my switch in my main function and cannot fix it.
I will explain the code a bit and hope you guys can help me:
Function initialization
void function1(char[]);
String array declaration
const char *my_array[] = {
"Array of strings one",
"Array of strings two",
"Array of strings three"};
Quoting over an array of strings in the main function (this works correctly, it prints an array of strings)
int i;
for (i=0; i < 3; i++) {
printf("%s\n", my_array[i]);
}
Code in switch function (still in main function)
case 4:
function1(my_array);
break;
I tested, and all the previous code works correctly, the problem is here (outside the main function):
void function1(char my_array[]) {
for (i=0; i < 3; i++) {
printf("%s\n", my_array[i]);
}
printf("\n");}
When I run case 4 of the switch, it fails.
Warning 2: log
warning: passing argument 1 of 'function1' from an incompatible pointer Type
warning: format '% s' expects an argument of type 'char *', but argument 2 is of type 'int' [-Wformat =]
, , , .
, , , , !