Why the value of i an j are being printed ,even before the user is entering the char values?
#include<stdio.h>
#include<conio.h>
int ans;
int visited[101][101]={{0}};
char maze[101][101];
int dfs(int r,int c,int n,int m);
int main()
{
int t,a,b,c,i,j,k,l,n,m;
scanf("%d",&n);
scanf("%d",&m);
for(i=1;i<=n;i++)
{
for(j=1;j<=m;j++)
{scanf("%c",&maze[i][j]);printf("i %d j %d\n",i,j);}
}printf("cvbds %c\n",maze[1][1]);
for(i=1;i<=n;i++)
{
for(j=1;j<=m;j++)
{printf("%c %d %d",maze[i][j],i,j);}printf("\n");
}ans=0;
for(i=1;i<=n;i++)
{
for(j=1;j<=m;j++)
{printf("%c\n",maze[i][j]);dfs(i,j,n,m);}
}
printf("%d\n",ans);
getch();
}
int dfs(int r,int c,int n,int m)
{ if(visited[r][c]==1)
return 0;
visited[r][c]=1;printf("hiSDFAS %d %d %c\n",r,c,maze[r][c]);
if((maze[r][c]=='S')&&(r+1<=n)&&visited[r+1][c]==0)
{printf("hi\n");dfs(r+1,c,n,m);}
if((maze[r][c]=='N')&&(r-1>=1)&&visited[r-1][c]==0)
{printf("viaksh\n");dfs(r-1,c,n,m);}
if((maze[r][c]=='E')&&(c+1<=m)&&visited[r][c+1]==0)
{printf("churu\n");dfs(r,c+1,n,m);}
if((maze[r][c]=='W')&&(c-1>=1)&&visited[r][c-1]==0)
{printf("maynk\n");dfs(r,c-1,n,m);}
if((r==n)&&(c==m))
{ans++;return 0;}
}