看不懂编译器的错误提示,但感觉是指针用错了吧。。求解
程序代码:
#include <stdio.h> int main (void) { int n,i,j; char a[30][30],b[30][30],c[30][30]; void dayin(int n,char *pa,char *pb,char *pc); scanf("%d",&n); i=0; while(i<n+1){ /*这里的循环是在初步的赋值,想打印3根柱子跟几个盘子。*/ a[i][n]='|'; for (j=0;j<n-i;j++) a[i][2*n-j]=a[i][j]=' '; for (j=n-i;j<n;j++) a[i][2*n-j]=a[i][j]='-'; for(j=0;j<2*n+1;j++){ if(j==n) b[i][j]=c[i][j]='|'; else b[i][j]=c[i][j]=' '; } i++; dayin(n,a,b,c); /*就是这里不知道哪里错了,看不懂编译器的提示*/ } void dayin(int n,char *pa,char *pb,char *pc) /*打印的函数*/ { int i,j; for(i=0;i<=n;i++){ for(j=0;j<=2*n;j++) printf("%c",pa[i][j]); printf("\t\t"); for(j=0;j<=2*n;j++) printf("%c",pb[i][j]); printf("\t\t"); for(j=0;j<=2*n;j++) printf("%c",pc[i][j]); printf("\n"); } }