Hi Pals, well my new problem is that I would like the output of my code as an array,and I dont get it at all, I would like to have the results of u[1][1] u[1][2] u[1][3] in my output

thanks

Code:/*Heat equation explicit scheme */ #include <stdio.h> #include<stdlib.h> #include<math.h> #define max 100 #define pi 4*atan(1) int main () { FILE *heat; float t[max],x[max],u[max][max],k,h,r,s; float tmax; int n,j,m,i; float xmax,nstep,alpha; /*printf("enter the value of L=");scanf("%d",xmax);*/ /*printf(" steps of x=");scanf("%f",nstep);*/ /*printf("maximun value of Tmax");scanf("%d",tmax);*/ /*printf("enter alpha");scanf("%d",alpha);*/ xmax=1; nstep=2; tmax=0.5; alpha=1; heat=fopen("heat.data","w"); /* Estability*/ /*h=xmax/nstep;*/ h=xmax/nstep; k=0.5*h*h/alpha; m=3; n=2; /* Boundary Conditions*/ for(j=0;j<=m;j++) { t[j]=j*k; u[0][j]=0; u[n][j]=0; } /*Initial Conditions*/ for(j=1;j<=n-1;j++) { x[j]=j*h; u[j][0]=10*sin(pi*x[j]*0.5); } /*Aproximations*/ r=alpha*k/k*h; s=1-2*r; for(j=1;j<=m;j++) { for(i=1;i<=n-1;i++) u[i][j]=s*u[i][j-1]+r*u[i-1][j-1]+r*u[i+1][j-1]; } for(j=0;j<=m;j++) { for(i=0;i<=n;i++) fprintf(heat,"%1.5f\n%1.5f\t",t[j],u[i][j]); /*printf("\n");*/ } fclose(heat); exit (0); }