P
pra_ramli
Hi all,
While coding, I got struck up in memory allocation for structure to
structure..
For instance..I wrote the following pgm..
#include <iostream.h>
#include <stdlib.h>
typedef struct A
{
int b;
int c;
struct E {
int d;
int e;
} *E;
} A;
void main()
{
A* i = (A * ) calloc(1,sizeof(A);
}
I need to allocate memory for the internal structure E. Iam getting
errors whatever format I follow.. i tried the following..
A.E = (E * ) calloc(1,sizeof(E);
A.E = (A.E * ) calloc(1,sizeof(E);
and other combinations..
Can anybody help me to sort out this problem???
Cheers,
Nick
While coding, I got struck up in memory allocation for structure to
structure..
For instance..I wrote the following pgm..
#include <iostream.h>
#include <stdlib.h>
typedef struct A
{
int b;
int c;
struct E {
int d;
int e;
} *E;
} A;
void main()
{
A* i = (A * ) calloc(1,sizeof(A);
}
I need to allocate memory for the internal structure E. Iam getting
errors whatever format I follow.. i tried the following..
A.E = (E * ) calloc(1,sizeof(E);
A.E = (A.E * ) calloc(1,sizeof(E);
and other combinations..
Can anybody help me to sort out this problem???
Cheers,
Nick