hi,
i have to allocate memory for 2d array so i can have view like
.............. | 1st column | 2nd column| 3rd column . . . . . . .
----------------------------------------------------------------------------------
1st row | sam | john | akash
-----------------------------------------------------------------------
2nd row | happy | honey | allll
.
.
.
.
if i want to print sam then
arrayname[0][1] it will print SAM
Last edited on
oh,sorry it should be arrayname[0][0]
Read the file in binary mode. Any file containing unprintable characters should be considered binary, and this is your case.
gaase, are you sure you're on the right topic?
Anyways, allocating memory for a 2D array:
int** array = new int[n][m];
If you know the size of the array at compile time,
int array[n][m];
More C++-ish solution:
vector<vector<int>> array;
True, haven't used multidimensional arrays in ages... and neither arrays for that matter. Maybe I should stop answering these kinds of questions.
How about
1 2 3 4 5
|
int** c = new int*[n];
for(int i=0;i<n;++i)
{
c[i]=new int[m];
}
|
Last edited on