Thread: what type ??? ... alternative?

  1. #1
    ~- Y u n a -~ beely's Avatar
    Join Date
    Dec 2001
    Posts
    291

    what type ??? ... alternative?

    so here's some example.

    typedef int datatype; // so this is integer type?
    typedef int linktype; // so this is integer type?

    typedef struct node {
    datatype item;
    linktype next;
    };

    datatype integer_type; // so this is global declaration?

    int main (void)
    {
    // problem occur here...
    integer_type x; // can i declar x in integertype ? instead of declar in integer.
    // or can i change it to "datatype x;" ?

    return 0;
    }

  2. #2
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,380
    >typedef int datatype; // so this is integer type?

    Yes.

    >typedef int linktype; // so this is integer type?

    Yes.

    >datatype integer_type; // so this is global declaration?

    Yes.

    >integer_type x; // can i declar x in integertype ? instead of declar in integer.

    No, because datatype is a type and integer_type is a variable. You have defined datatype to be the type int. So your global declaration declares integer_type to be a variable of type datatype, which is an int.

  3. #3
    ~- Y u n a -~ beely's Avatar
    Join Date
    Dec 2001
    Posts
    291
    yup i got an ideals. thanks again for help

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 0
    Last Post: 03-20-2008, 07:59 AM
  2. Little Array Difficulty
    By G4B3 in forum C Programming
    Replies: 16
    Last Post: 03-19-2008, 12:59 AM
  3. typename madness
    By zxcv in forum C++ Programming
    Replies: 4
    Last Post: 05-13-2006, 10:35 PM
  4. Errors
    By Rhidian in forum C Programming
    Replies: 10
    Last Post: 04-04-2005, 12:22 PM
  5. gcc problem
    By bjdea1 in forum Linux Programming
    Replies: 13
    Last Post: 04-29-2002, 06:51 PM