title: Saving matrix to a file (.txt format) in C
body: <p>I'm having some issues trying to write a quick program which purpose is, given a matrix (bidimensional array allocated dinamically), saving it to a file. When checking the resulting output file I'm given at the end of each line of the file the following simbols, in bold and red, "\00".
  This is my code:</p>
  
  <pre><code>   /*\param n number of rows
      \param m number of columns
      \param mat pointer to the matrix
      \param f file already opened in write mode where to write the matrix 
     */
  int save_to_file (char** mat, unsigned n, unsigned m, FILE* f){
  
      int i, j;   
  
      for(i = 0;i &lt;= n; i++)
          for(j = 0; j &lt;= m; j++)
              if(j == m)
                  fprintf(f, "%c\n", mat[i][j]);
              else
                  fprintf(f, "%c", mat[i][j]);
      if (f == NULL)
          return -1;
      else
          return 0;
  }
  </code></pre>
  
  <p>Is the issue lying in the way I'm writing on the file? If that's the case, can anybody help me to fix it?</p>