1
I intend to create a struct
where there will be a vector of structs
... The way I thought of doing it was kind of like this:
typedef struct{
char *teste_str;
int teste_int;
}TESTE_A;
typedef struct{
TESTE_A **t;
}TESTE_B;
TESTE_B teste;
int main(void)
{
teste.t = (TESTE_A**)malloc(3 * sizeof(TESTE_A*));
teste.t[0]->teste_int = 25;
printf("%d\n", teste.t[0]->teste_int);
return 0;
}
But why member value is not changed and program error?
The first thing you need to decide is whether to do it in C or C++. What happens when you try to compile? The code looks confusing. I don’t know what the point is, but there seems to be things in there that shouldn’t be.
– Maniero