R
ramu
Hi,
While am trying to run this code am getting segmentation fault.
What's wrong with this code?
Here am trying to assign a value to the variable b.
#define SIZE 10
struct y {
int a;
struct x {
int b;
} *c[SIZE];
} d;
main()
{
d.c[SIZE] = malloc(10 * sizeof(struct x));
d.c[0]->b=10;
printf("%d",d.c[0]->b);
}
Regards
While am trying to run this code am getting segmentation fault.
What's wrong with this code?
Here am trying to assign a value to the variable b.
#define SIZE 10
struct y {
int a;
struct x {
int b;
} *c[SIZE];
} d;
main()
{
d.c[SIZE] = malloc(10 * sizeof(struct x));
d.c[0]->b=10;
printf("%d",d.c[0]->b);
}
Regards