P
Paminu
If I have this struct:
typedef struct test{
int x;
int y;
}container;
Now I would like to make an array of 5 pointers to this struct:
int main(void){
container *cp[5];
cp=malloc(sizeof(container));
container->content="big";
container->tt=malloc(sizeof(container *)*5); //THIS LINE GIVES ERROR!
return 0;
}
But how do I allocate space for these pointers? Do I have to do it for each
one at a time?
typedef struct test{
int x;
int y;
}container;
Now I would like to make an array of 5 pointers to this struct:
int main(void){
container *cp[5];
cp=malloc(sizeof(container));
container->content="big";
container->tt=malloc(sizeof(container *)*5); //THIS LINE GIVES ERROR!
return 0;
}
But how do I allocate space for these pointers? Do I have to do it for each
one at a time?