summaryrefslogtreecommitdiff
path: root/rush/max_search_y.c
diff options
context:
space:
mode:
Diffstat (limited to 'rush/max_search_y.c')
-rw-r--r--rush/max_search_y.c69
1 files changed, 69 insertions, 0 deletions
diff --git a/rush/max_search_y.c b/rush/max_search_y.c
new file mode 100644
index 0000000..c3680a4
--- /dev/null
+++ b/rush/max_search_y.c
@@ -0,0 +1,69 @@
+#include <unistd.h>
+
+void change_to_4(int *y)
+{
+
+ *y = 4;
+
+}
+
+void change_to_max_y(int z[4][4], int a, int b)
+{
+ int x;
+ x = 0;
+
+ while (x < 4)
+ {
+ int y;
+ y = 0;
+ while (y < 4)
+ {
+ if (y >= (a - 1) && y <= (4 - b))
+ change_to_4(&z[y][x]);
+ y++;
+ }
+ x++;
+ }
+}
+
+void ft_putchar(char c)
+{
+ write(1, &c ,1);
+}
+
+int main(void)
+{
+ int str[16] = {3, 3, 1, 2, 1, 2, 2, 3, 2, 3, 2, 1, 2, 1, 2, 3};
+
+ int matrix[4][4] = {{0}};
+
+ int a;
+ int b;
+
+ a = 0;
+ b = 4;
+
+ while (a < 4 && b < 8)
+ {
+ change_to_max_y(matrix, str[a], str[b]);
+ a++;
+ b++;
+ }
+
+ int i;
+ int j;
+
+ i = 0;
+ while (i <= 3)
+ {
+ j = 0;
+ while (j <= 3)
+ {
+ ft_putchar(matrix[i][j] + '0');
+ j++;
+ }
+ ft_putchar(0x0a);
+ i++;
+ }
+
+} \ No newline at end of file