Dear all,
I need to know the how do i allocate memory to structure array dynamically.I tried this but couldn't help me..
struct A{
int i;
};
void main()
{
struct A *a1;
int i;
for(i=0;i<10;i++){
a1=(struct A*)malloc(sizeof(struct A*));
}
}
when i tried to compile this it threw some error..wud appreciate if someone could help me!!
Thanx in advance, Santhosh Ravindran
I need to know the how do i allocate memory to structure array dynamically.I tried this but couldn't help me..
struct A{
int i;
};
void main()
{
struct A *a1;
int i;
for(i=0;i<10;i++){
a1=(struct A*)malloc(sizeof(struct A*));
}
}
when i tried to compile this it threw some error..wud appreciate if someone could help me!!
Thanx in advance, Santhosh Ravindran