Search Results

Search found 1 results on 1 pages for 'user1708505'.

Page 1/1 | 1 

  • 3x3 array = 10 numbers

    - by user1708505
    i have this code #include <math.h> #include <stdio.h> const int n = 3; const int s = 3; int getm(int mat[n][s]); int printm(int mat[n][s]); int main() { int m[n][s]; getm(m); printm(m); return 0; } int getm(int mat[n][s]) { for(int x = 0;x < n;x++) { for (int y = 0;y<s;y++) { scanf("%i ", &mat[x][y]); } } return 0; } int printm(int mat[n][s]) { for(int x = 0;x<n;x++) { for(int y = 0;y<s;y++) { printf("%i ", mat[x][y]); if(y==(s-1)) { printf("\n"); } } } } which shoud ask for 9 numbers to make a 3x3 matrix array, but it actually asks for 10 numbers, printm is working well - printing only 9 numbers. Where is error?

    Read the article

1