I have 2 sructures :
struct b{int b;float d;}; and
struct a{int count; struct b* ptr;}
struct a *a_temp;
Now i allocate memory for 10 strucutures of type b and put the address in ptr of struct a. (the code was given to me and they didnt want to use double pointer for some reason)
a_temp = (struct a*)malloc(sizeof(struct a));
a_temp->ptr = (struct b*)malloc(10*sizeof(struct b));
struct b* b_temp;
I have to load the address of second structure of type b to temp_b.
I tried b_temp = a_temp->ptr[1];
which is giving error
but b_temp = &(a_temp->ptr[1]);
is working when i try to use this and access contents of structure b using this,why is this?
thanks in advance