CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Threaded View

  1. #1
    Join Date
    Jan 2008
    Posts
    60

    Dynamic Allocation problem with lists

    I have something like this:

    Code:
    #include <iostream>
    #include <cstdlib>
    #include <ctime>
    using namespace std;
    
    struct boy
    {
    	int age;
    	string name;
    };
    
    void main()
    {
    	typedef boy* botPtr;
    
    	botPtr * As[6000];
    	for( int i = 0 ; i < 6000 ; i++)
    		As[i] = new botPtr;
    
    	botPtr * Ps = new botPtr[2000];
    
    	Ps[0]->age;
    	As[0]->age //produces an error
    }
    How can i access the As[0] data structure elements
    Last edited by armen_shlang; June 3rd, 2008 at 07:11 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured