Thread: typedef struct question

  1. #1
    Registered User
    Join Date
    Sep 2002

    typedef struct question

    I am trying to incorporate some OpenGL code into my Kylix3 app, and have run across a difficulty not with OpenGL or Kylix, but C of all things.

    in Kylix, there is the following typedef:
    typedef struct QWidget__
    int dummy;
    } *QWidgetH

    Now, I have a function that returns me a QWidgetH *, and I have another function that needs to have a QWidget__ * passed into it. My problem is:

    What the heck does that typedef mean? I am familiar with 'tagging' a struct so you can reference it from within the struct.... but this is strange. What does:

    typedef struct a__ {int dummy} *a mean? What do you think is the proper incantation of *'s and &'s to massage my QWidgetH * into a QWidget__ *?

    Any help you can provide would be appreciated.

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    struct x { };l

    Define a structure named 'x'.

    struct x { } y;

    Define a structure named 'x', and create an instance of it, called 'y'.

    typedef struct x y;

    Define a new type, called 'y', which is of type 'struct x'.

    So, if I want an instance of this last item:

    struct x myInstance;


    y myInstance;

    They're the same thing.

    Any questions?

    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help with linked list sorting function
    By Jaggid1x in forum C Programming
    Replies: 6
    Last Post: 06-02-2009, 02:14 AM
  2. struct question
    By ctovb in forum C Programming
    Replies: 3
    Last Post: 08-13-2008, 11:23 AM
  3. typedef struct
    By Bleech in forum C Programming
    Replies: 4
    Last Post: 12-30-2006, 07:18 PM
  4. Need help understanding info in a header file
    By hicpics in forum C Programming
    Replies: 8
    Last Post: 12-02-2005, 12:36 PM
  5. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM