Last active
February 17, 2018 17:42
-
-
Save ayaderaghul/b4a3f42f1ea9a16ebacd746d6d8fc89e to your computer and use it in GitHub Desktop.
print char array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <unistd.h> | |
void ft_putchar(c) | |
{ | |
write(1, &c, 1); | |
} | |
void print_array(char *arr) | |
{ | |
int x; | |
int y; | |
y = 0; | |
while (y < 9) | |
{ | |
x = 0; | |
while (x < 9) | |
{ | |
ft_putchar(arr[x + y * 9]); | |
if (x < 8) | |
ft_putchar(' '); | |
x++; | |
} | |
if (y < 8) | |
ft_putchar('\n'); | |
y++; | |
} | |
} | |
int main() | |
{ | |
// char **b = malloc(81 * sizeof(char)); | |
char b[9][9] = {{'1','2','3','4','5','6','7','8','9'},{'1','2','3','4','5','6','7','8','9'},{'1','2','3','4','5','6','7','8','9'},{'1','2','3','4','5','6','7'\ | |
,'8','9'},{'1','2','3','4','5','6','7','8','9'},{'1','2','3','4','5','6','7','8','9'},{'1','2','3','4','5','6','7','8','9'},{'1','2','3','4','5','6','7','8','9'},\ | |
{'1','2','3','4','5','6','7','8','9'}}; | |
print_array((char*)b); | |
return(0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment