Please help me i dont know why this doesnt work
Code:
#include <stdio.h>
#include<time.h>
void array();
int main()
{
printf("CAN SOME ONE TELL ME WHY THIS DOESNT WORK\n");
printf("AND IF YOU COULD SHOW ME THE CORRECTION");
array();
}
void array()
{
int check(int num, int array[4][4]) {
int i, j;
for (i = 0; i < 4; i++) {
for (j = 0; j < 4; j++) {
if (array[i][j] == num) {
return 1;
}
}
}
return 2;
}
int main() {
int x,y,arr[4][4];
int w;
int ok=0;
srand(time(NULL));
for (x=0;x<4;x++)
{
for(y=0;y<4;y++)
{
if (x ==3 && y ==3) {
printf("| \t");
}
else {
ok =1;
while (ok!=2) {
w = rand()%15+1;
ok = check(w, arr);
}
arr[x][y] = w;
printf("| %i\t",arr[x][y]);
}
}
printf("|\n");
}
return 0;
}