I am trying to read the data from a file and store into a 2D array(the file contains 540000 values), but i m facing memory issues. Then my friend suggested to create a dynamic 2D array, i thought thats simple but when i searched for the code on web, i was in vain and hardly implement those stuff.
Can anyone please tell me how do i declare,intialize and access a 2D array dynamically.
The code which i tried to implement is below, but i am ending up in errors
FILE *fp; //file pointer for reading a file
DataLat=new double; // 2-D array for holding all the file values
int row=0, col=0; // row column and column declaration, used in 2-d array
fp = fopen("lat.txt", "r");
if ( fp == NULL )
puts("Unable to open the file");
exit(1); //terminate program
fclose( fp );