for(i = 0; i < n; i++){
srand(time(NULL));
printf(\"%d \", time(NULL));
for(j = 0; j < (n-1); j++){
a[i][j] = rand();
Sergey, you did not get an error message with the a[i,j]
version simply because this is a perfectly valid expression. The comma operator evaluates the sub-expressions from left to right and returns the value of the last expression. Thus, writing a[i,j]
is identical to a[j]
. What you received in the print was the value of the pointer to the j-th vector in your matrix.