Need help in getting const char*
array from function so elements can be printed in main.
main:
const char* values[3];
strings_to_array();
printf("%s\n", values[1]);
printf("%s\n", values[2]);
function:
const char* strings_to_array()
{
char one_str[16];
char two_str[16];
char three_str[16];
strcpy(one_str, "one");
strcpy(two_str, "two");
strcpy(three_str, "three");
const char* values[] = {one_str, two_str, three_str};
return values;
}
What is incorrect here and how to get values to main?