title: Recursive shortest path finding in C
body: <p>I want to make a program that finds the shortest path from 0x0 to the mxn point recursively and change the values of the path to <code>'-'</code>. <code>'1'</code> values in the matrix means path and <code>'0'</code> means wall, and I can go in all directions.</p>
  <p>I'm very fresh, so please try to explain the details as much you can.</p>
  <pre><code>int startRow = 0, startColumn = 0;
  char fun(char arr[][3]);
  
  int main()
  {   
     
      char matrix[3][3] = { {1,0,1},{1,1,0},{0,1,1} };
      for (int i = 0; i &lt; 3; i++)
      {
          for (int j = 0; j &lt; 3; j++)
          {
              printf(&quot;%d\t&quot;, matrix[i][j]);
          }
          printf(&quot;\n&quot;);
      }
  
      fun(matrix);
  
      
      for (int i = 0; i &lt; 3; i++)
      {
          for (int j = 0; j &lt; 3; j++)
          {
              printf(&quot;%d\t&quot;, matrix[i][j]);
          }
          printf(&quot;\n&quot;);
      }
  
  
      return 0;
  }
  
  char fun(char arr[][3])
  {
      if (arr[startColumn][startRow+1] != 0)
      {
          arr[startColumn][startRow + 1] = '-';
          return fun(arr[startColumn][startRow + 1]);
      }
  
      else
      {   
          startRow = 0;
          return fun(arr[startColumn + 1][startRow]);
  
      }
  }
  </code></pre>
  <p>The output should be like this:
  <a href="https://i.stack.imgur.com/FEeWT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FEeWT.png" alt="the output should be like this:" /></a></p>