CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2001
    Posts
    6

    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;

  2. #2
    Join Date
    Feb 2001
    Posts
    6
    sorry.. data in

    h[i].r.g = 0;

    changes like

    h[i].r.g = atoi(chr);

    where chr is a character.

  3. #3
    Join Date
    Jul 2002
    Posts
    2,543
    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?

  4. #4
    Join Date
    Mar 2002
    Location
    California
    Posts
    1,582
    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
  •  





Click Here to Expand Forum to Full Width

Featured