Click to See Complete Forum and Search --> : Structure and pointer problems
Cecile
September 22nd, 2002, 08:09 AM
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;
Cecile
September 22nd, 2002, 08:16 AM
sorry.. data in
h[i].r.g = 0;
changes like
h[i].r.g = atoi(chr);
where chr is a character.
Alex F
September 22nd, 2002, 09:48 AM
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?
jfaust
September 22nd, 2002, 10:45 AM
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
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.