This is C programming assignment. The objective of this homework is to give you practice using make files to compose an executable file from a set of source files and adding additional functions to an existing set of code. This assignment will give you an appreciation for the ease with which well designed software can be extended. For this assignment, you will use both the static and dynamic assignment versions of the matrix software. Using each version, do the following:
1.Develop a module which calculates the transpose of a matrix. Your module should return a matrix with the elements interchanged so that A_out[i][j] = A_in[j][i]. (You should be able to use the same module for both the static and dynamic versions.)
2.Generate a makefile that you can use to compile the set of modules to generate the executable file.
3.Modify the set of software so that the matrix elements are now integers, rather than a double precision float value.
4.Execute your transpose file with both the static and dynamic implementation and the version with integer elements. Copy the outputs to a text file to demonstrate proper execution.
What to submit: Please submit a copy of the modified source files, makefiles, and a text file(s) that includes execution output that demonstrates proper operation for all cases.
Here is all the codes they gave to us:
This is C programming assignment.
The objective of this homework is to give you practice using make files to compose an executable file from a set of source files and adding additional functions to an existing set of code. This assignment will give you an appreciation for the ease with which well designed software can be extended. For this assignment, you will use both the static and dynamic assignment versions of the matrix software. Using each version, do the following:
1.Develop a module which calculates the transpose of a matrix. Your module should return a matrix with the elements interchanged so that A_out[i][j] = A_in[j][i]. (You should be able to use the same module for both the static and dynamic versions.)
2.Generate a makefile that you can use to compile the set of modules to generate the executable file.
3.Modify the set of software so that the matrix elements are now integers, rather than a double precision float value.
4.Execute your transpose file with both the static and dynamic implementation and the version with integer elements. Copy the outputs to a text file to demonstrate proper execution.
What to submit: Please submit a copy of the modified source files, makefiles, and a text file(s) that includes execution output that demonstrates proper operation for all cases.
Here is all the codes they gave to us:
/* File: matrix_dynamic.c */
#include "matrix_dynamic.h"
matrix create_empty(int rdim, int cdim)
{
int i;
matrix result;
/* assign values to the row_dim and col_dim structure members */
result.row_dim = rdim;
result.col_dim = cdim;
result.element = (T**)malloc(rdim * sizeof(T*));
for (i=0; i<rdim; i++)
result.element[i] = (T*)malloc(cdim * sizeof(T));
return result;
}
matrix create_initval(int rdim, int cdim, T val)
{
int i,j;
matrix result;
/* assign values to the structure members */
result.row_dim = rdim;
result.col_dim = cdim;
result.element = (T**)malloc(rdim * sizeof(T*));
for (i=0; i<rdim; i++)
result.element[i] = (T*)malloc(cdim * sizeof(T));
/* initialize the matrix elements */
for (i=0; i<rdim; i++)
for (j=0; j<cdim; j++)
result.element[i][j] = val;
return result;
}
matrix create_initvals(int rdim, int cdim, T* initval)
{
int i,j;
matrix result;
/* assign values to the structure members */
result.row_dim = rdim;
result.col_dim = cdim;
result.element = (T**)malloc(rdim * sizeof(T*));
for (i=0; i<rdim; i++)
result.element[i] = (T*)malloc(cdim * sizeof(T));
/* initialize the matrix elements */
for (i=0; i<rdim; i++)
for (j=0; j<cdim; j++)
result.element[i][j] = *(initval + (cdim * i + j));
return result;
}
void destroy(matrix m)
{
int i;
for (i=0; i<m.row_dim; i++)
free(m.element[i]);
free(m.element);
free(&m);
}
T retrieve(int row, int col, matrix m)
{
return(m.element[row][col]);
}
void assign(int row, int col, matrix* m, T elm)
{
m->element[row][col] = elm;
}
void matrix_print(matrix m)
{
int i,j;
printf("\n");
for (i=0; i<m.row_dim; i++) {
printf("\n");
for (j=0; j<m.col_dim; j++)
printf(FORMAT, m.element[i][j]);
}
printf("\n");
}
matrix add(matrix m1, matrix m2)
{
int i,j;
matrix result;
assert((m1.row_dim == m2.row_dim) && (m1.col_dim == m2.col_dim));
result = create_empty(m1.row_dim, m2.col_dim);
for (i=0; i<m1.row_dim; i++)
for (j=0; j<m1.col_dim; j++)
result.element[i][j] = m1.element[i][j] + m2.element[i][j];
return result;
}
matrix subtract(matrix m1, matrix m2)
{
int i,j;
matrix result;
assert((m1.row_dim == m2.row_dim) && (m1.col_dim == m2.col_dim));
result = create_empty(m1.row_dim, m2.col_dim);
for (i=0; i<m1.row_dim; i++)
for (j=0; j<m1.col_dim; j++)
result.element[i][j] = m1.element[i][j] - m2.element[i][j];
return result;
}
matrix negate(matrix m)
{
int i,j;
matrix result;
result = create_empty(m.row_dim, m.col_dim);
for (i=0; i<m.row_dim; i++)
for (j=0; j<m.col_dim; j++)
result.element[i][j] = -m.element[i][j];
return result;
}
matrix multiply(matrix m1, matrix m2)
{
int i,j,k;
matrix result;
assert(m1.col_dim == m2.row_dim);
result = create_empty(m1.row_dim, m2.col_dim);
for (i=0; i<m1.row_dim; i++)
for (j=0; j<m2.col_dim; j++) {
result.element[i][j] = 0;
for (k=0; k<m1.col_dim; k++)
result.element[i][j] += m1.element[i][k] * m2.element[k][j];
}
return result;
}
matrix scalar_multiply(T scalar, matrix m)
{
int i,j;
matrix result;
result = create_empty(m.row_dim, m.col_dim);
for (i=0; i<m.row_dim; i++)
for (j=0; j<m.col_dim; j++)
result.element[i][j] = scalar * m.element[i][j];
return result;
}
void equate(matrix* m1, matrix* m2)
{
int i,j;
assert((m1->row_dim == m2->row_dim) && (m1->col_dim == m2->col_dim));
for (i=0; i<m1->row_dim; i++)
for (j=0; j<m1->col_dim; j++)
m2->element[i][j] = m1->element[i][j];
}
/* File: matrix_dynamic.h */
#ifndef MATRIXh
#define MATRIXh
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#define FORMAT "%8.3lf"
typedef double T;
typedef struct {
int row_dim, col_dim;
T** element;
} matrix;
/* function prototypes */
matrix create_empty(int rdim, int cdim);
matrix create_initval(int rdim, int cdim, T val);
matrix create_initvals(int rdim, int cdim, T* initval);
void destroy(matrix);
void matrix_print(matrix);
T retrieve(int row, int col, matrix m); /* retrieve an element from m */
void assign(int row, int col, matrix*, T val); /* assign a value to an element of m */
void equate(matrix* m1, matrix* m2); /* m1 = m2 */
matrix add(matrix, matrix);
matrix subtract(matrix, matrix);
matrix negate(matrix);
matrix multiply(matrix, matrix);
matrix scalar_multiply(T scalar, matrix);
/* remaining function prototypes not shown */
#endif
/* File: test_dynamic.c */
#include "matrix_dynamic.h"
int main()
{
static T data[] = {1,2,3,4};
matrix a,b;
a = create_initvals(2,2,data);
b = create_empty(2,2);
equate(&a,&b);
printf("\n Matrix a:");
matrix_print(a);
printf("\n Matrix b:");
matrix_print(b);
printf("\n a+b:");
matrix_print(add(a,b));
}
/* File: matrix_static.c */
#include "matrix.h"
matrix create_empty(int rdim, int cdim)
{
int i;
matrix result;
/* assign values to the row_dim and col_dim structure members */
result.row_dim = rdim;
result.col_dim = cdim;
return result;
}
matrix create_initval(int rdim, int cdim, T val)
{
int i,j;
matrix result;
/* assign values to the structure members */
result.row_dim = rdim;
result.col_dim = cdim;
/* initialize the matrix elements */
for (i=0; i<rdim; i++)
for (j=0; j<cdim; j++)
result.element[i][j] = val;
return result;
}
matrix create_initvals(int rdim, int cdim, T* initval)
{
int i,j;
matrix result;
/* assign values to the structure members */
result.row_dim = rdim;
result.col_dim = cdim;
/* initialize the matrix elements */
for (i=0; i<rdim; i++)
for (j=0; j<cdim; j++)
result.element[i][j] = *(initval + (cdim * i + j));
return result;
}
T retrieve(int row, int col, matrix m)
{
return(m.element[row][col]);
}
void assign(int row, int col, matrix* m, T elm)
{
m->element[row][col] = elm;
}
void matrix_print(matrix m)
{
int i,j;
printf("\n");
for (i=0; i<m.row_dim; i++) {
printf("\n");
for (j=0; j<m.col_dim; j++)
printf(FORMAT, m.element[i][j]);
}
printf("\n");
}
matrix add(matrix m1, matrix m2)
{
int i,j;
matrix result;
assert((m1.row_dim == m2.row_dim) && (m1.col_dim == m2.col_dim));
result = create_empty(m1.row_dim, m2.col_dim);
for (i=0; i<m1.row_dim; i++)
for (j=0; j<m1.col_dim; j++)
result.element[i][j] = m1.element[i][j] + m2.element[i][j];
return result;
}
matrix subtract(matrix m1, matrix m2)
{
int i,j;
matrix result;
assert((m1.row_dim == m2.row_dim) && (m1.col_dim == m2.col_dim));
result = create_empty(m1.row_dim, m2.col_dim);
for (i=0; i<m1.row_dim; i++)
for (j=0; j<m1.col_dim; j++)
result.element[i][j] = m1.element[i][j] - m2.element[i][j];
return result;
}
matrix negate(matrix m)
{
int i,j;
matrix result;
result = create_empty(m.row_dim, m.col_dim);
for (i=0; i<m.row_dim; i++)
for (j=0; j<m.col_dim; j++)
result.element[i][j] = -m.element[i][j];
return result;
}
matrix multiply(matrix m1, matrix m2)
{
int i,j,k;
matrix result;
assert(m1.col_dim == m2.row_dim);
result = create_empty(m1.row_dim, m2.col_dim);
for (i=0; i<m1.row_dim; i++)
for (j=0; j<m2.col_dim; j++) {
result.element[i][j] = 0;
for (k=0; k<m1.col_dim; k++)
result.element[i][j] += m1.element[i][k] * m2.element[k][j];
}
return result;
}
matrix scalar_multiply(T scalar, matrix m)
{
int i,j;
matrix result;
result = create_empty(m.row_dim, m.col_dim);
for (i=0; i<m.row_dim; i++)
for (j=0; j<m.col_dim; j++)
result.element[i][j] = scalar * m.element[i][j];
return result;
}
void equate(matrix* m1, matrix* m2)
{
int i,j;
assert((m1->row_dim == m2->row_dim) && (m1->col_dim == m2->col_dim));
for (i=0; i<m1->row_dim; i++)
for (j=0; j<m1->col_dim; j++)
m2->element[i][j] = m1->element[i][j];
}
/* File: matrix_static.h */
#ifndef MATRIXh
#define MATRIXh
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#define FORMAT "%8.3lf"
#define MAX_ROW 10
#define MAX_COL 10
typedef double T;
typedef struct {
int row_dim, col_dim;
T element[MAX_ROW][MAX_COL];
} matrix;
/* function prototypes */
matrix create_empty(int rdim, int cdim);
matrix create_initval(int rdim, int cdim, T val);
matrix create_initvals(int rdim, int cdim, T* initval);
void destroy(matrix);
void matrix_print(matrix);
T retrieve(int row, int col, matrix m); /* retrieve an element from m */
void assign(int row, int col, matrix*, T val); /* assign a value to an element of m */
void equate(matrix* m1, matrix* m2); /* m1 = m2 */
matrix add(matrix, matrix);
matrix subtract(matrix, matrix);
matrix negate(matrix);
matrix multiply(matrix, matrix);
matrix scalar_multiply(T scalar, matrix);
/* remaining function prototypes not shown */
#endif
/* File: test_static.c */
#include "matrix.h"
int main()
{
static T data[] = {1,2,3,4};
matrix a,b;
a = create_initvals(2,2,data);
b = create_empty(2,2);
equate(&a,&b);
printf("\n Matrix a:");
matrix_print(a);
printf("\n Matrix b:");
matrix_print(b);
printf("\n a+b:");
matrix_print(add(a,b));
}
//dynamic
test_dynamic.c
/* File: test_dynamic.c */
#include "matrix_dynamic.h"
#include "transpose.h"
int main()
{
static T data[] = {1,2,3,4};
matrix a,b;
a = create_initvals(2,2,data);
b = create_empty(2,2);
equate(&a,&b);
printf("\n Matrix a:");
matrix_print(a);
printf("\n Matrix b:");
matrix_print(b);
printf("\n a+b:");
matrix_print(add(a,b));
printf("\n transposing a");
matrix_print(transpose(a));
printf("\n transposing a+b");
matrix_print((transpose(add(a,b))));
}
matrix_dynamic.h
/* File: matrix_dynamic.h */
#ifndef MATRIXh
#define MATRIXh
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
typedef int T;
#define FORMAT "%i " // This has to be changed if T is changed.
typedef struct {
int row_dim, col_dim;
T** element;
} matrix;
/* function prototypes */
matrix create_empty(int rdim, int cdim);
matrix create_initval(int rdim, int cdim, T val);
matrix create_initvals(int rdim, int cdim, T* initval);
void destroy(matrix);
void matrix_print(matrix);
T retrieve(int row, int col, matrix m); /* retrieve an element from
m */
void assign(int row, int col, matrix*, T val); /* assign a value to
an element of m */
void equate(matrix* m1, matrix* m2); /* m1 = m2 */
matrix add(matrix, matrix);
matrix subtract(matrix, matrix);
matrix negate(matrix);
matrix multiply(matrix, matrix);
matrix scalar_multiply(T scalar, matrix);
/* remaining function prototypes not shown */
#endif
matrix_dynamic.c
/* File: matrix_dynamic.c */
#include "matrix_dynamic.h"
matrix create_empty(int rdim, int cdim)
{
int i;
matrix result;
/* assign values to the row_dim and col_dim
structure members */
result.row_dim = rdim;
result.col_dim = cdim;
result.element = (T**)malloc(rdim *
sizeof(T*));
for (i=0; i<rdim; i++)
result.element[i] =
(T*)malloc(cdim * sizeof(T));
return result;
}
matrix create_initval(int rdim, int cdim, T val)
{
int i,j;
matrix result;
/* assign values to the structure members
*/
result.row_dim = rdim;
result.col_dim = cdim;
result.element = (T**)malloc(rdim *
sizeof(T*));
for (i=0; i<rdim; i++)
result.element[i] =
(T*)malloc(cdim * sizeof(T));
/* initialize the matrix elements */
for (i=0; i<rdim; i++)
for (j=0; j<cdim;
j++)
result.element[i][j] = val;
return result;
}
matrix create_initvals(int rdim, int cdim, T* initval)
{
int i,j;
matrix result;
/* assign values to the structure members
*/
result.row_dim = rdim;
result.col_dim = cdim;
result.element = (T**)malloc(rdim *
sizeof(T*));
for (i=0; i<rdim; i++)
result.element[i] =
(T*)malloc(cdim * sizeof(T));
/* initialize the matrix elements */
for (i=0; i<rdim; i++)
for (j=0; j<cdim;
j++)
result.element[i][j] = *(initval + (cdim * i + j));
return result;
}
void destroy(matrix m)
{
int i;
for (i=0; i<m.row_dim; i++)
free(m.element[i]);
free(m.element);
free(&m);
}
T retrieve(int row, int col, matrix m)
{
return(m.element[row][col]);
}
void assign(int row, int col, matrix* m, T elm)
{
m->element[row][col] = elm;
}
void matrix_print(matrix m)
{
int i,j;
printf("\n");
for (i=0; i<m.row_dim; i++) {
printf("\n");
for (j=0;
j<m.col_dim; j++)
printf(FORMAT, m.element[i][j]);
}
printf("\n");
}
matrix add(matrix m1, matrix m2)
{
int i,j;
matrix result;
assert((m1.row_dim == m2.row_dim) &&
(m1.col_dim == m2.col_dim));
result = create_empty(m1.row_dim,
m2.col_dim);
for (i=0; i<m1.row_dim; i++)
for (j=0;
j<m1.col_dim; j++)
result.element[i][j] = m1.element[i][j] + m2.element[i][j];
return result;
}
matrix subtract(matrix m1, matrix m2)
{
int i,j;
matrix result;
assert((m1.row_dim == m2.row_dim) &&
(m1.col_dim == m2.col_dim));
result = create_empty(m1.row_dim,
m2.col_dim);
for (i=0; i<m1.row_dim; i++)
for (j=0;
j<m1.col_dim; j++)
result.element[i][j] = m1.element[i][j] - m2.element[i][j];
return result;
}
matrix negate(matrix m)
{
int i,j;
matrix result;
result = create_empty(m.row_dim,
m.col_dim);
for (i=0; i<m.row_dim; i++)
for (j=0;
j<m.col_dim; j++)
result.element[i][j] = -m.element[i][j];
return result;
}
matrix multiply(matrix m1, matrix m2)
{
int i,j,k;
matrix result;
assert(m1.col_dim == m2.row_dim);
result = create_empty(m1.row_dim,
m2.col_dim);
for (i=0; i<m1.row_dim; i++)
for (j=0;
j<m2.col_dim; j++) {
result.element[i][j] = 0;
for (k=0; k<m1.col_dim; k++)
result.element[i][j] += m1.element[i][k] * m2.element[k][j];
}
return result;
}
matrix scalar_multiply(T scalar, matrix m)
{
int i,j;
matrix result;
result = create_empty(m.row_dim,
m.col_dim);
for (i=0; i<m.row_dim; i++)
for (j=0;
j<m.col_dim; j++)
result.element[i][j] = scalar * m.element[i][j];
return result;
}
void equate(matrix* m1, matrix* m2)
{
int i,j;
assert((m1->row_dim == m2->row_dim)
&& (m1->col_dim == m2->col_dim));
for (i=0; i<m1->row_dim; i++)
for (j=0;
j<m1->col_dim; j++)
m2->element[i][j] = m1->element[i][j];
}
transpose.h
// select which module to use for matrix data type
// This has to be done when testing each modules
//#include "matrix_static.h"
#include "matrix_dynamic.h"
// function prototypes
// matrix -> matrix
// returns a matrix with the rows and columbs fliped
// A_out[i,j] = A_in[j,i]
matrix transpose(matrix m);
transpose.c
#include "transpose.h"
// matrix -> matrix
// returns a matrix with the rows and columbs fliped
// A_out[i,j] = A_in[j,i]
matrix transpose(matrix m) {
matrix result = create_empty(m.col_dim,
m.row_dim);
for (int i = 0, x = m.col_dim; i < x; i++)
{
for (int j = 0, y =
m.row_dim; j < y; j++) {
result.element[i][j] = m.element[j][i];
}
}
return result;
}
test_dynamic_output.txt
Matrix a:
1 2
3 4
Matrix b:
1 2
3 4
a+b:
2 4
6 8
transposing a
1 3
2 4
transposing a+b
2 6
4 8
//static
test_static.c
/* File: test_static.c */
#include "matrix_static.h"
#include "transpose.h"
int main()
{
static T data[] = {1,2,3,4};
matrix a,b;
a = create_initvals(2,2,data);
b = create_empty(2,2);
equate(&a,&b);
printf("\n Matrix a:");
matrix_print(a);
printf("\n Matrix b:");
matrix_print(b);
printf("\n a+b:");
matrix_print(add(a,b));
printf("\n transposing a");
matrix_print(transpose(a));
printf("\n transposing a+b");
matrix_print((transpose(add(a,b))));
}
matrix_static.h
/* File: matrix_static.h */
#ifndef MATRIXh
#define MATRIXh
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#define MAX_ROW 10
#define MAX_COL 10
typedef int T;
#define FORMAT "%d " // This has to be changed if T is changed
typedef struct {
int row_dim, col_dim;
T element[MAX_ROW][MAX_COL];
} matrix;
/* function prototypes */
matrix create_empty(int rdim, int cdim);
matrix create_initval(int rdim, int cdim, T val);
matrix create_initvals(int rdim, int cdim, T* initval);
void destroy(matrix);
void matrix_print(matrix);
T retrieve(int row, int col, matrix m); /* retrieve an element from
m */
void assign(int row, int col, matrix*, T val); /* assign a value to
an element of m */
void equate(matrix* m1, matrix* m2); /* m1 = m2 */
matrix add(matrix, matrix);
matrix subtract(matrix, matrix);
matrix negate(matrix);
matrix multiply(matrix, matrix);
matrix scalar_multiply(T scalar, matrix);
/* remaining function prototypes not shown */
#endif
matrix_static.c
/* File: matrix_static.c */
#include "matrix_static.h"
matrix create_empty(int rdim, int cdim)
{
matrix result;
/* assign values to the row_dim and col_dim
structure members */
result.row_dim = rdim;
result.col_dim = cdim;
return result;
}
matrix create_initval(int rdim, int cdim, T val)
{
int i,j;
matrix result;
/* assign values to the structure members
*/
result.row_dim = rdim;
result.col_dim = cdim;
/* initialize the matrix elements */
for (i=0; i<rdim; i++)
for (j=0; j<cdim;
j++)
result.element[i][j] = val;
return result;
}
matrix create_initvals(int rdim, int cdim, T* initval)
{
int i,j;
matrix result;
/* assign values to the structure members
*/
result.row_dim = rdim;
result.col_dim = cdim;
/* initialize the matrix elements */
for (i=0; i<rdim; i++)
for (j=0; j<cdim;
j++)
result.element[i][j] = *(initval + (cdim * i + j));
return result;
}
T retrieve(int row, int col, matrix m)
{
return(m.element[row][col]);
}
void assign(int row, int col, matrix* m, T elm)
{
m->element[row][col] = elm;
}
void matrix_print(matrix m)
{
int i,j;
printf("\n");
for (i=0; i<m.row_dim; i++) {
printf("\n");
for (j=0;
j<m.col_dim; j++)
printf(FORMAT, m.element[i][j]);
}
printf("\n");
}
matrix add(matrix m1, matrix m2)
{
int i,j;
matrix result;
assert((m1.row_dim == m2.row_dim) &&
(m1.col_dim == m2.col_dim));
result = create_empty(m1.row_dim,
m2.col_dim);
for (i=0; i<m1.row_dim; i++)
for (j=0;
j<m1.col_dim; j++)
result.element[i][j] = m1.element[i][j] + m2.element[i][j];
return result;
}
matrix subtract(matrix m1, matrix m2)
{
int i,j;
matrix result;
assert((m1.row_dim == m2.row_dim) &&
(m1.col_dim == m2.col_dim));
result = create_empty(m1.row_dim,
m2.col_dim);
for (i=0; i<m1.row_dim; i++)
for (j=0;
j<m1.col_dim; j++)
result.element[i][j] = m1.element[i][j] - m2.element[i][j];
return result;
}
matrix negate(matrix m)
{
int i,j;
matrix result;
result = create_empty(m.row_dim,
m.col_dim);
for (i=0; i<m.row_dim; i++)
for (j=0;
j<m.col_dim; j++)
result.element[i][j] = -m.element[i][j];
return result;
}
matrix multiply(matrix m1, matrix m2)
{
int i,j,k;
matrix result;
assert(m1.col_dim == m2.row_dim);
result = create_empty(m1.row_dim,
m2.col_dim);
for (i=0; i<m1.row_dim; i++)
for (j=0;
j<m2.col_dim; j++) {
result.element[i][j] = 0;
for (k=0; k<m1.col_dim; k++)
result.element[i][j] += m1.element[i][k] * m2.element[k][j];
}
return result;
}
matrix scalar_multiply(T scalar, matrix m)
{
int i,j;
matrix result;
result = create_empty(m.row_dim,
m.col_dim);
for (i=0; i<m.row_dim; i++)
for (j=0;
j<m.col_dim; j++)
result.element[i][j] = scalar * m.element[i][j];
return result;
}
void equate(matrix* m1, matrix* m2)
{
int i,j;
assert((m1->row_dim == m2->row_dim)
&& (m1->col_dim == m2->col_dim));
for (i=0; i<m1->row_dim; i++)
for (j=0;
j<m1->col_dim; j++)
m2->element[i][j] = m1->element[i][j];
}
test_static_output.txt
Matrix a:
1 2
3 4
Matrix b:
1 2
3 4
a+b:
2 4
6 8
transposing a
1 3
2 4
transposing a+b
2 6
4 8
makefile
test_static: test_static.o matrix_static.o transpose.o
matrix_static.h matrix_static.c transpose.h transpose.c
gcc -o test_static test_static.o transpose.o
matrix_static.o
test_dynamic: test_dynamic.o matrix_dynamic.o transpose.o
matrix_dynamic.h matrix_dynamic.c transpose.h transpose.c
gcc -o test_dynamic test_dynamic.o transpose.o
matrix_dynamic.o
test_static.o: test_static.c matrix_static.h transpose.c
transpose.h
gcc -Wall -g -c test_static.c
test_dynamic.o: test_dynamic.c matrix_dynamic.h transpose.c
transpose.h
gcc -Wall -g -c test_dynamic.c
transpose.o: matrix_dynamic.h matrix_static.h transpose.c
transpose.h
gcc -Wall -g -c transpose.c
clean:
rm *.o -f
Get Answers For Free
Most questions answered within 1 hours.