0

Salam,

lets say I have declared:

int* array=new int[SIZE];

(I used this array as if it was a 2D array - lets say that I'll consider these dimensions: row, column).
and I want to pass this array to a function that will fill the array row by row.
(The function will calculate an array of size row and I want to put this array on the row of the original array).
I'll fill it like this:

--------->
--------->
--------->
..
..
--------->

Thanks

2
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by 3bdelhakeem
0

Are you asking for code? If yes, then we'll not give you code :P

Try to do it yourself and if you get stuck in anything, We'll look into your problem.

0

Ok.. :D

I have this code:

int **array;
array=new int* [ROWS];  //ROWS are defined
for(int i=0;i<ROWS;i++)
*(array+i)=new int[COLS];  //COLS are defined

I allocated a 2D array. Now I want to fill this array, row by row, each row will be calculated as an array.

static void function(int* array) {
int line[4];
// some calculations on line[4]
// now I want to put line on the first line of the 2D array 'array'.
// I have no idea how to implement this. :)
}
0

Ok.. :D
I allocated a 2D array. Now I want to fill this array, row by row, each row will be calculated as an array.

now I want to put line on the first line of the 2D array 'array'.

What do you mean by that, give me an example.
Do you want to put line on the first row of array[][]

Edited by mike_2000_17: Fixed formatting

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.