srand(time(NULL));
for(i = 0; i < n; i++){
for(j = 0; j < (n-1); j++){
a[i][j] = rand();
}
}
I try to generate random numbers, but they are the same... What should i do?
Array declaration:
int** a;
int i;
printf("Enter array size: ");
scanf("%d", &n);
a = (int**)calloc(n, sizeof(int));
for(i = 0; i < n; i++)
a[i] = (int*)calloc(n-1, sizeof(int));
Thanks everybody. Reason was that i print a[i,j]
instead of a[i][j]
.