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

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.

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. :)
}

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[][]

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.