[OT] C question (typedef & structs)

Chris Pressey cpressey at catseye.mine.nu
Thu Oct 2 09:01:52 PDT 2003


On Thu, 02 Oct 2003 11:54:39 -0400
Bill Moran <wmoran at potentialtech.com> wrote:

> Hey gang,

Hi Bill,

> Actually, 2 questions:
> 
> 1) What's the difference between:
> 
> struct customStruct {
>      int RecID;
>      char *Name;
> };
> 
> and
> 
> typedef struct customStruct {
>      int RecID;
>      char *Name;
> };

The latter is incomplete.  Try

  typedef struct customStruct {
       int RecID;
       char *Name;
  } MyCustomStruct;

See also

http://www.phim.unibe.ch/comp_doc/c_manual/C/SYNTAX/typedef.html

-Chris


More information about the freebsd-questions mailing list