I am trying to access and manipulate a list of strings from a function in C but for some reason i get a seg fault as soon as the loop in the function does 1 pass.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void print_stuff(char*** what)
{
for(int i = 0; i < sizeof(*what); ++i)
{
*what[i] = malloc(5 * sizeof(*what));
*what[i] = "hello";
printf("%s\n", *what[i]);
}
}
int main(void)
{
char** hello;
hello = malloc(20 * sizeof(*hello));
print_stuff(&hello);
}