I have declared a structure within a structure. but it keeps on getting unhandled exception, why is this so?
struct b {
int v;
struct n {
int o;
unsigned chat g;
} r;
}
struct b *h;
h = (struct b *) calloc(10, sizeof(struct b);
h[i].r.g = 0;
Printable View
I have declared a structure within a structure. but it keeps on getting unhandled exception, why is this so?
struct b {
int v;
struct n {
int o;
unsigned chat g;
} r;
}
struct b *h;
h = (struct b *) calloc(10, sizeof(struct b);
h[i].r.g = 0;
sorry.. data in
h[i].r.g = 0;
changes like
h[i].r.g = atoi(chr);
where chr is a character.
I don't see the problem in inner structure. There are two points
in your code fragment that may cause error:
1) What is i value?
2) atoi(chr) - atoi expects const char*, and what is chr type?
If you give us an example that compiles, I'm sure we can help you. Until then it's all guesses. My guess is that i > 9.
Jeff