main.back.c 634 Bytes
#include "matrix.h"
#include <stdio.h>
#include <stdlib.h>


int main(){

	matrix *m1,*m2, *m3;

	m1 = matrix_init (3,3);
	m2 = matrix_init (3,3);
	
	for(int i=0; i < matrix_get_rows(m1); i++){
		for (int j=0; j < matrix_get_columns(m1); j++){
			set(m1, i, j, 1);
		}
	}

//it has to be special (1) matrix
	matrix_null (m2);
	int n = matrix_get_rows(m2);
	if (matrix_get_columns(m2) < n ) 
		n = matrix_get_columns(m2);

	for(int i=0; i < n; i++){
		set(m2, i, i, 1);
	}


	m3 = matrix_summ (m1, m2);
	matrix_print (m1);
	matrix_print (m2);
	matrix_print (m3);
	matrix_free (m1);
	matrix_free (m2);
	matrix_free (m3);
	return 0;
}