Tell me please, what am I doing wrong? You need to enter and display the matrix, that's it.
int main() { int* matr; int n,m; scanf("%i",&n); scanf("%i",&m); matr = malloc(m*n*sizeof(int)); for (int j = 0; j < m; ++j) { for (int i = 0; i < n; ++i) { scanf("%i",&matr[j,i]); } } for (int j = 0; j < m; ++j) { for (int i = 0; i < n; ++i) { printf("%2i",matr[j,i]); } puts(""); } return 0; } Ввод: 3 3 1 2 3 4 5 6 7 8 9 Вывод: 7 8 9 7 8 9 7 8 9 UPD:
int printline(int* line){ for (int j = 0; j < n; j++) { printf("%2i ",line[i]); } } Enter:
3 4 2 1 0 3 5 6 7 9 8 1 5 2 Conclusion :
5 6 -1414812757