N
Neha
Hi all
Its seems bit silly que but pleasee explan me why this error is coming
? and what will be the solution if i want void * to be intilaize by
struct * and this code is puerly in C.
--
#include <stdlib.h>
#include <stdio.h>
#include <memory.h>
typedef struct AAA
{
unsigned char str;
}Abbb;
typedef struct BBB
{
Abbb ab;
}Bbbb;
int main()
{
void *a;
a= (Bbbb *) malloc(sizeof(Bbbb));
a->ab.str='c';
printf("%c",a->ab.str);
return 0;
}
erorr----------
test.c
D:\C-C++\test.c(27) : error C2223: left of '->ab' must point to
struct/union
D:\C-C++\test.c(29) : error C2223: left of '->ab' must point to
struct/union
Thanx in Advance
Neha
Its seems bit silly que but pleasee explan me why this error is coming
? and what will be the solution if i want void * to be intilaize by
struct * and this code is puerly in C.
--
#include <stdlib.h>
#include <stdio.h>
#include <memory.h>
typedef struct AAA
{
unsigned char str;
}Abbb;
typedef struct BBB
{
Abbb ab;
}Bbbb;
int main()
{
void *a;
a= (Bbbb *) malloc(sizeof(Bbbb));
a->ab.str='c';
printf("%c",a->ab.str);
return 0;
}
erorr----------
test.c
D:\C-C++\test.c(27) : error C2223: left of '->ab' must point to
struct/union
D:\C-C++\test.c(29) : error C2223: left of '->ab' must point to
struct/union
Thanx in Advance
Neha