How can I pass a char* array as a parameter, without creating one and initializing it?
This code works (creating an initializing one):
char *messages[] = {"Zero", "One", "Two", "Three"};
printf("%s", messages[1]);
But it wont work if you pass it like so:
#include <stdio.h>
void printElement1(char *messages[]) {
printf("%s", messages[1]);
}
int main(void) {
printElement1({"Zero", "One", "Two", "Three"});
return 1;
}
I cannot use a va_list, the function takes a char* array and that's that.