How to return a matrix from a function, in c?
<p>My c code for matrix addition is given below:</p>

<pre><code>mat(int n,int a[][5],b[][5] ){
   int i,c[5][5];

   for(i=0;i&lt;5;i++){
       for(j=0;j&lt;5;j++)
           c[i][j]=a[i][j]+b[i][j];

    return c;
}
</code></pre>

<p>When I compile this my compiler caught error:</p>

<pre><code>||warning: command line option '-Wzero-as-null-pointer-constant' is valid for C++/ObjC++ but not for C [enabled by default]|
C:\Users\Amir Khasru\Desktop\retuturn_a_matrix.c|2|warning: return type defaults to 'int' [-Wreturn-type]|
C:\Users\Amir Khasru\Desktop\retuturn_a_matrix.c|2|warning: no previous declaration for 'mat' [-Wmissing-declarations]|
C:\Users\Amir Khasru\Desktop\retuturn_a_matrix.c||In function 'mat':|
C:\Users\Amir Khasru\Desktop\retuturn_a_matrix.c|8|error: return makes integer from pointer without a cast|
||=== Build failed: 1 error(s), 3 warning(s) (0 minute(s), 0 second(s)) ===|
</code></pre>