411 REFERENCE · Wikibooks
Linear Algebra and the C Language/a0iu
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
__NOTOC__
Install and compile this file in your working directory.
/* ------------------------------------ */
/* Save as : c00b.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
int main(void)
{
double **A = i_mR(R3, C5 );
double **B = i_mR(rsize_R(A),csize_R(A));
clrscrn();
printf(" A[%d][%d]:",rsize_R(A),csize_R(A));
p_mR(A, S4,P0,C7);
printf(" B[%d][%d]:",rsize_R(B),csize_R(B));
p_mR(B, S4,P0,C7);
stop();
f_mR(A);
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
If I want to copy the size of a matrix, I can use rsize_R(A); and csize_R(A);. In the next example, we will see that we can also directly read the size of the matrix from memory.
Screen output example:
A[3][5]:
+0 +0 +0 +0 +0
+0 +0 +0 +0 +0
+0 +0 +0 +0 +0
B[3][5]:
+0 +0 +0 +0 +0
+0 +0 +0 +0 +0
+0 +0 +0 +0 +0
Press return to continue.