|
-
September 22nd, 2002, 08:09 AM
#1
Structure and pointer problems
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;
-
September 22nd, 2002, 08:16 AM
#2
sorry.. data in
h[i].r.g = 0;
changes like
h[i].r.g = atoi(chr);
where chr is a character.
-
September 22nd, 2002, 09:48 AM
#3
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?
-
September 22nd, 2002, 10:45 AM
#4
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|