Click here to Skip to main content
15,997,667 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I wanted to create a dynamic 2d array , but ended up with the following error :

[Error] C:\Users\User\Documents\C-Free\Temp\Untitled2.cpp:8: E2034 Cannot convert 'int ( *)[100]' to 'int *' in function main()


This was compiled using Borland C++ 5.5.

Below is the troublesome code :
int * h = NULL;
    h = new int[100][100];
    if(h==NULL)
    {

        cout<<"\nERROR : No more space available.";
        exit(1);

    }


What could be wrong with this? What is the correct syntax if wrong?
Also suggest a way how to deallocate the memory used by it.
Posted

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900