I will get uppertringular part of a matrix.For example ı have a matrix :
1 2 3
4 5 6
7 8 9 ı will register as 1 2 3 4 5 6 9 in an array.This is my Code what is wrong ?
Besides, memcpy simply "mysteriously" copies raw bytes while an array to array copy like this with loop(s) show clearly what the function does. Its simply an indexing dilemma.
@candidate:
The problem in your code is that you have a N*N matrix and you try to copy the triangular elements from it into N-element array.
For example, N=3 --> N*N==9 and the triangular matrix has 6 elements. 6>3 means trouble.
Oh, I'm sorry, I didn't know what upper triangular is
Besides, memcpy simply "mysteriously" copies raw bytes while an array to array copy like this with loop(s) show clearly what the function does. Its simply an indexing dilemma.
You think so?
well, memcpy has a well defined behaviour, so it does not just mysteriously do things ^^
But as I stated earlier, I didn't know what upper triangular is an since it was a 3x3 matrix i though he wanted to have the first 3 elements, which is obviously not needed here.