Thread: Question about Struct

  1. #1
    Registered User
    Join Date
    Feb 2010
    Posts
    25

    Question about Struct

    When making a struct, why do some structs have struct* ? Does that mean there is a pointer to the struct? If so, then why would it be struct* block, instead of struct *block? Thanks in advance.
    Last edited by Hikaru90; 02-25-2010 at 02:13 PM.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Perhaps you should provide some code that demonstrates what you are talking about.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Apr 2009
    Posts
    66
    struct* block and struct *block are same ,
    they are the pointer to the struct.

    Let me say some simple example ( probably u may aware of this )
    for ex :
    Code:
     
     int* a ;  // pointer to an int 
     int *b ;  // pointer to an int 
     int*c , d ; //  c is a pointer to an int , but d is a normal int , 
     int  *e, *f ; // e and f is a pointer to an int  
     int* e , *f ; // are same as above

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... difference between passing to function...
    By Sparrowhawk in forum C++ Programming
    Replies: 6
    Last Post: 02-23-2009, 03:59 PM
  3. Global Variables
    By Taka in forum C Programming
    Replies: 34
    Last Post: 11-02-2007, 03:25 AM
  4. struct question
    By caduardo21 in forum Windows Programming
    Replies: 5
    Last Post: 01-31-2005, 04:49 PM
  5. Passing pointers between functions
    By heygirls_uk in forum C Programming
    Replies: 5
    Last Post: 01-09-2004, 06:58 PM