Create a 2D array with 20 rows and 20 columns. Populate the array row-by-row with random real numbers (not integers) that range in value from 0 to 100. Copy the diagonal elements of the 2D array into a 1D array.
My professor also gave this information: In your main function, you simply create a for loop where A[i] = B[i][i]. The diagonal elements are B[0][0], B[1][1], B[2][2], etc. B[0][0] gets copied to A[0], B[1][1] to A[1], and so on.
But I don't know how to incorporate this into my program, I'm quite new to this.
My program thus far:
//Ive just been able to setup the the 20x20 multidimensional array with random //real numbers 0-100. Someone please help me incorporate the information above.
Sorry for the late reply. yes as Tarik said I have not yet learned memcpy function in class so I'm assuming I cannot use that.Only using the information I have posted above am I suppose to write this code. I have re-posted the question on the forums to further input other peoples answers to this problem.