Simple typedef question

This is a discussion on Simple typedef question within the C Programming forums, part of the General Programming Boards category; This works too: #define NodePtr struct *Node Quzah....

  1. #16
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    This works too:

    #define NodePtr struct *Node

    Quzah.
    Hope is the first step on the road to disappointment.

  2. #17
    Registered User
    Join Date
    Mar 2002
    Posts
    22

    Question Doubt!

    Nutshell wrote:

    typedef struct stackNode StackNode;
    typedef StackNode *StackNodePtr;
    ----------------------------------------------------

    First typedef: StackNode is synonymic to struct stackNode.

    Second typedef, it can be rewrited as "typedef struct stackNode *StackNodePtr", true or false?

    If this is true, then *StackNodePtr is synonymic to StackNode which is also struct stackNode. Then, how on earth a pointer can be a synonym to a structure?? I'm really confuse. Please help!

  3. #18
    Unregistered
    Guest
    Second typedef, it can be rewrited as "typedef struct stackNode *StackNodePtr", true or false?

    If this is true, then *StackNodePtr is synonymic to StackNode which is also struct stackNode. Then, how on earth a pointer can be a synonym to a structure?? I'm really confuse. Please help!

    *StackNodePtr is not synonymous to StackNode. "typedef struct stackNode *StackNodePtr" declares a POINTER to the stackNode struct. StackNode, on the other hand, is declared as a synonym for struct stackNode, but NOT a pointer to that struct. So that's the difference.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Simple Question!!
    By gameuser in forum C++ Programming
    Replies: 2
    Last Post: 06-06-2009, 06:42 PM
  2. Simple class question
    By 99atlantic in forum C++ Programming
    Replies: 6
    Last Post: 04-21-2005, 12:41 AM
  3. Simple question about pausing program
    By Noid in forum C Programming
    Replies: 14
    Last Post: 04-02-2005, 09:46 AM
  4. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 04:00 PM
  5. typedef struct question
    By flevine100 in forum C Programming
    Replies: 1
    Last Post: 09-03-2002, 10:34 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21