2021-12-05 17:19:10 +01:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "array_2D_int.h"
|
|
|
|
#include "input.h"
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
size_t number_of_rows = 0;
|
|
|
|
size_t number_of_columns = 0;
|
|
|
|
char *direction = input();
|
2023-08-10 11:13:06 +02:00
|
|
|
int **array_input = array_2D_int_input(&number_of_rows, &number_of_columns);
|
2021-12-05 17:19:10 +01:00
|
|
|
|
2023-08-10 11:13:06 +02:00
|
|
|
int **array;
|
2021-12-05 17:19:10 +01:00
|
|
|
if (strcmp(direction, "clockwise") == 0) {
|
2023-08-10 11:13:06 +02:00
|
|
|
array = array_2D_int_rotate_90_degrees_clockwise(array_input, &number_of_rows, &number_of_columns);
|
2021-12-05 17:19:10 +01:00
|
|
|
} else {
|
2023-08-10 11:13:06 +02:00
|
|
|
array = array_2D_int_rotate_90_degrees_anticlockwise(array_input, &number_of_rows, &number_of_columns);
|
2021-12-05 17:19:10 +01:00
|
|
|
}
|
|
|
|
array_2D_int_print(array, number_of_rows, number_of_columns);
|
|
|
|
|
2023-08-10 11:13:06 +02:00
|
|
|
free(direction);
|
|
|
|
for (size_t row = 0; row < number_of_rows; row++) {
|
|
|
|
free(array[row]);
|
2021-12-05 17:19:10 +01:00
|
|
|
}
|
|
|
|
free(array);
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|