From a44e5fda1fc3ed3b146392e14744b573fcf1b3d8 Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Sun, 1 May 2016 20:32:57 -0400 Subject: [PATCH] Add helpful printing functions for testing --- trans.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/trans.c b/trans.c index e6ec5db..114842b 100644 --- a/trans.c +++ b/trans.c @@ -12,6 +12,29 @@ int is_transpose(int M, int N, int A[N][M], int B[M][N]); +void print_array(int M, int N, int A[N][M], int x, int y) +{ + int i,j; + for (i = 0; i < N; i++) { + for (j = 0; j < M; j++) { + if(i == y && j == x) + printf("\x1B[31m # \x1B[0m"); + else + printf(" # "); + } + printf("\n"); + } +} + +void diff_array(int M, int N, int A[N][M], int B[M][N], int x, int y) +{ + printf("%d, %d\n", x, y); + print_array(M, N, A, x, y); + printf("\n"); + print_array(N, M, B, y, x); + getchar(); +} + /* * transpose_submit - This is the solution transpose function that you * will be graded on for Part B of the assignment. Do not change