• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: C question about structs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C question about structs


  • Subject: Re: C question about structs
  • From: "Clark S. Cox III" <email@hidden>
  • Date: Mon, 23 Jul 2001 23:31:30 -0400

On Monday, July 23, 2001, at 01:31 , Alex Golovinsky wrote:

Hi, this is a straight C question. I have, say, struct A which includes struct B and struct B, which has as a member struct A. How do I declare this without getting undefined types? I was under the impression that I could do the following:

typedef struct B;

typedef struct
{
B *myb;
}A;

typedef struct
{
A *mya;
}B;

/*I like to keep my typedefs seperate from the actual structure declaration*/
typedef struct A A;
typedef struct B B;

struct A
{
B *myb;
};

struct B
{
A *mya;
};

however, project builder does not like this.

BTW, it's not project builder that rejects the code, it's the compiler (gcc).


References: 
 >C question about structs (From: Alex Golovinsky <email@hidden>)

  • Prev by Date: Re: Use of NSLog() for debugging
  • Next by Date: Re: Use of NSLog() for debugging
  • Previous by thread: Re: C question about structs
  • Next by thread: Bundle and multiple classes (ScreenSaver related stuff)
  • Index(es):
    • Date
    • Thread