Thread: structure declaration

  1. #1
    Registered User
    Join Date
    Feb 2003
    Posts
    175

    structure declaration

    Hello All,

    Want to make typedef concept clear by implementing following
    Code:
    typedef node
    {
    	int a;
    	int b;	
    };
    
    typedef tot
    {
    	struct node theNode[32];  //  <-- Is there any memory allocated for this???   
                                                              
    };
    
    struct tot theTot;
    First two typedef strcture declartion do not allocate any memory at all. But last structure declaration will allocate total 256 bytes of memory( considering 4 bytes for int)

    Let me know, whether my above statement is correct.

  2. #2
    Registered User Vber's Avatar
    Join Date
    Nov 2002
    Posts
    807
    You're trying to typedef a struct? well, try something like this
    Code:
    typedef struct {
        int blah, bleh;
        char *str, ch;
    } idea;
    
    idea id[60];
    http://www.cs.caltech.edu/~petrovic/...ypothello.html

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Quantum Random Bit Generator
    By shawnt in forum C++ Programming
    Replies: 62
    Last Post: 06-18-2008, 10:17 AM
  2. failure to import external C libraries in C++ project
    By nocturna_gr in forum C++ Programming
    Replies: 3
    Last Post: 12-02-2007, 03:49 PM
  3. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  4. Errors with including winsock 2 lib
    By gamingdl'er in forum C++ Programming
    Replies: 3
    Last Post: 12-05-2005, 08:13 PM
  5. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM