例如:
int *p[];
p=new int[ma];
其中ma为可变 
用完后
delete p[];
大体是这样;

解决方案 »

  1.   

    楼上的,不知你自己测试过没有,如果ma不为CONST类型或宏定义,就不可能通过编译!!
    C编译器不允许定义大小不定的数组。
    但可通过动态内存分配实现。如,
    C :    int *pBuffer = remalloc()
    WIN16:   GlobalAlloc()/GlobalReAlloc()  
    WIN32:   HeapAlloc()/globalReAlloc() 
      

  2.   

    有没有其他方法了?关键是之前的数据不能丢失。
    例如:class person
    {public:
    CString name;
    long age;
    }
    person *persons[0]=new person;
    persons[0].name="wang";
    persons[0].age=32;
    这时候要在数组里再加一个人persons[1],我该如何做而不失去persons[0]的资料?
      

  3.   

    直接使用集合类型类或模板即可,如 CObArray / CTypedPtrArray<,>