Initialize undefined size arrays

Sometimes it is not possible to know the size of an array before allocating it.

If the programmer wants to avoid the waste of memory using non-shrinkable arrays, it would be required to create a new array with the correct size and delete the old array after copying its elements.

Note that it is also possible to use other implementations, such as linked lists or some others that allow dynamic size.

On some cases, such as those, on which the arrays have a defined maximum size, its elements must be sequentially aligned and its real size is unknown before the allocation, it would be useful for the programmer to have standard shrinkable arrays.

/* author: */
using namespace std;

void*operator new[](size_t s){
    return malloc(s);
void operator delete[](void*p){
void operator delete[](void*p,size_t s){
    if(realloc(p,s)!=p)throw 0;

int main(){
    typedef unsigned int A;
    A S=25,*s=new A[S];
    A**aa=new A*[S];
    for(A i=0;i<S;i++){
        A*a=new A[S],*b=a;
        for(A j=0;j<S;j++){
            //Suggested syntax:
            operator delete[](b,s[i]*sizeof(A));
    for(A i=0;i<S;i++){
        for(A j=0;j<s[i];j++){
    return 0;