Hello, I have a task of solving a 20 by 20 maze. The problem im facing is that currently, I take a .txt file in and have to solve a maze for J amount of mazes.

Im having problems getting my if and elses arranged in my solveMaze function to solve each maze one by one using non AI methods, always check spot above then to the left then below then to the right etc.

Was wondering if any of you would like to give me some assistance on starting my solveMaze function. Because the arrays first element starts at 0 having some trouble skipping to next mazes etc in the for loops.

Code:
#include <stdio.h>
#include <stdlib.h>


struct stackNode{
	
	int data;
	struct stackNode *nextptr;
};



void push(struct stackNode **topptr, int info);
int pop(struct stackNode **topptr);
void readFile(char *file);
int num_of_mazes;
void solveMaze(char *** maze);


int main()
{
	char fname[30];
	int i,j;
	
	
	printf("What is the file name of the maze you wish to solve?");
	scanf("%s", &fname);
	
	readFile(fname);
	
	return 0;
}



void readFile(char *file)
	{
	int i,j;
	
	int num_of_mazes;
	
	
	
	
	FILE *infile; // file 
	
		// If statement for opening file and error for fail.
		if((infile = fopen(file, "r")) == NULL)
		{
			printf("Error Opening File. \n");
			exit(1);
		}

	fscanf(infile, "%d", &num_of_mazes);
	
	char ***maze;
	maze = (char ***) malloc((20 * num_of_mazes) * sizeof(char **));
		for(i = 0; i < (20 * num_of_mazes); i++)
		{
		maze[i] =(char **) malloc(20 * sizeof(char *));
			for(j = 0; j < 20; j++)
			{
				maze[i][j] = (char *) malloc(sizeof(char));
			}
		}
	
	for(i = 0; i < (20 * num_of_mazes); i++)
	{
		for(j = 0; j < 20; j++)
		{
			fscanf(infile, "%c", &maze[i][j]);
			printf("%c", maze[i][j]);
		}
	
	}
	
	solveMaze(maze);
	
	}
	
	
	void solveMaze(char ***maze)
	{
		int i,j,k;
		
				
		struct stackNode **xstack;
		struct stackNode **ystack;
		
		int currentx, currenty;
		
		
		
		for(k = 1; k <= num_of_mazes; k++)
		{
		
			for(i = 0; i < (20 * k); i++)
			{
				for(j = 0; j < 20; j++)
				{
					
					
					
					
				}
			
			}
		}
		
		
		
				
		}
	
	int pop(struct stackNode **topptr)
	{
		
		struct stackNode *tmp;
		
		if( *topptr != NULL)
		{
			tmp = *topptr;
			*topptr = (struct stackNode *) tmp->nextptr;
			int temp2;
			temp2 = tmp->data;
			free(tmp);
			return temp2;
		}
		else{
			printf("Pop function error.");
			exit(0);
		
		}
		
	
	}
	
	void push(struct stackNode **topptr, int info)
	{
		
		struct stackNode *temp;
		
		temp = (struct stackNode *)malloc(sizeof(struct stackNode));
		
			temp->data = info;
			temp->nextptr = *topptr;
			*topptr = temp;
			
	}