I have a struct that contains an array of strings but I'm lost regarding how to use it sometimes
For instance :
struct A
{
char** b;
};
size_t two = 2;
struct A a = malloc(sizeof(struct A));
b = (char**) malloc(sizeof(char*) * 2);
a->b[0] = "1";
snprintf(a->b[1], 4, "%d", two); //this line makes a mess
It works perfectly fine if I use snprintf for a variable that I define as char* type, but isn't a->b[1] a char* type itself ?
Why doesn't it work (if I use a printf on a->b[1], it displays the value but the program crashes when I do any malloc afterward) and what should I do to make it work ?