#include <stdio.h> int main() { int i,j,n; scanf("%d",&n); char a[n][n]; for(i=0;i<n;++i) for( j=0;j<n;++j) scanf("%d",a[i][j]); for( i=0;i<n;++i) for( j=0;j<n;++j) if(j==n-1) printf("%d\n",a[j[i]); else printf("%d ",a[j][i]; } /* Main.c: In function 'main': Main.c:10:11: warning: format '%d' expects argument of type 'int *', but argument 2 has type 'int' [-Wformat=] scanf("%d",a[i][j]); ^ Main.c:15:37: error: subscripted value is neither array nor pointer nor vector printf("%d\n",a[j[i]); ^ Main.c:15:40: error: expected ']' before ')' token printf("%d\n",a[j[i]); ^ Main.c:17:56: error: expected ')' before ';' token printf("%d ",a[j][i]; ^ Main.c:20:1: error: expected ';' before '}' token } ^ */ |
Double click to view unformatted code.