difference between these two struct definitions

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • oo@@oo

    #1

    difference between these two struct definitions

    Hello

    What is the difference between these two struct definitions ?

    -------------------------header.h
    ---------------------------------------
    struct A{
    int a;
    int b;
    struct B
    {
    int (*fp1)(void);
    int (*fp2)(void);
    } *pb;
    };

    and

    ------------------------- another header.h
    ---------------------------------------
    struct B
    {
    int (*fp1)(void);
    int (*fp2)(void);
    } ;

    struct A{
    int a;
    int b;
    struct B *pb;
    };

    Thank you in advance.

  • Hallvard B Furuseth

    #2
    Re: difference between these two struct definitions

    OnlyOpenSource writes:
    What is the difference between these two struct definitions ?
    In C, nothing. In C++, the inner struct gets the name A::B in
    one case and B in the other.
    struct A{
    (...)
    struct B
    {
    (...)
    int (*fp2)(void);
    } *pb;
    };
    >
    and
    >
    struct B
    (...)
    } ;
    struct A{
    (...)
    struct B *pb;
    };
    --
    Hallvard

    Comment

    Working...