title: Trying to solve maze using depth-first search algorithm, but does not print the right coordinates
body: <p>I am trying to search for the starting position of the maze by looping through the maze.txt. For that, in my stack ADT, I passed all of my functions three arguments, the stack, the x position and the y position, I tried testing the stack ADT using simple values and it seems to push nodes and pop nodes pretty well, however when I try it on the maze, it doesn't seem to be obtaining the right coordinates for the starting position. This is how I have implemented it to obtain the starting position. (I am using my linked list ADT in my stack ADT and I have create x pos and y pos in my stack struct)</p>
  
  <p>I am using the depth-first search algorithm in a non-recursive way to solve the maze. As of now, I am really lost on how to approach this, I've searched everywhere, but I have yet to find a non-recursive algorithm. For now, I am planning on searching through every single direction and pushing and pop depending on if the move is valid or not. I would really like to improve myself as a programmer and would like to understand thoroughly on how to solve the maze so if in the future if I encounter something like this I can solve it using the best techniques out there which take less time. </p>
  
  <pre><code>void mazeSolution(char**maze)
  {
      stack*currentCell;
      int i;
      int j;
  
      i=0;
      j=0;
  
      currentCell = create();
  
      while(maze[i][j] == 'F')
      {
         if(maze[i][j] == 'S')
         {
            currentCell-&gt;xpos = i;
  
            currentCell-&gt;ypos = j;
  
           push(currentCell,currentCell-&gt;xpos,currentCell-&gt;ypos);
         }
      }
  
      printStack(currentCell);
  }
  
  void printList(node*theList)
  {
      node*currentPosition;
  
      currentPosition = theList;
  
      while(currentPosition != NULL)
      {
          printf("This is the value of the current node : %d, %d\n",currentPosition-&gt;xpos, currentPosition-&gt;ypos);
          currentPosition= currentPosition-&gt;next;
      }
  }
  
  
  void printStack(stack*theStack)
  {
      printList(theStack-&gt;list);
  
  }
  </code></pre>
  
  <p>I actually noticed something, without the create() and if I comment out the entire while loop, if I just called the printStack(); it will still print 0,0 so that means that there is something wrong with the way I have printed or the way I am pushing the node. However, I don't understand why it works perfectly fine when I test with a bunch of values...not with maze</p>