title: Using octave built-in function in C
body: <p>I am told to compile this program using C in octave. I have succeeded in compiling a simple C program before using Octave, but for this one, I have tried and I have no idea how to compile it in C even though I have tried to change some of the C++ language into C language. </p>
  
  <pre><code> #include &lt;iostream&gt;
  
   #include &lt;octave/oct.h&gt;
  
   int main (void)
  
   {
   std::cout &lt;&lt; "Hello Octave world!\n";
  
   int n = 2;
  
   Matrix a_matrix = Matrix (n, n);
  
   for (octave_idx_type i = 0; i &lt; n; i++)
  
   for (octave_idx_type j = 0; j &lt; n; j++)
  
   a_matrix(i,j) = (i + 1) * 10 + (j + 1);
  
   std::cout &lt;&lt; a_matrix;
  
   return 0;
   }
  </code></pre>
  
  <p>So is there any solution to this problem? 
  Thank you very much and sorry for any mistakes in the post that I made since I'm pretty new in using octave and in this forum.</p>
  
  <p>EDIT (After Alter Mann's Answer):</p>
  
  <p>So this is my C program code</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main(void)
  {
          printf("Hello Octave World!");
  
      int n=2;
      Matrix a_matrix = Matrix (n, n);
  
      for (octave_idx_type i=0; i&lt;n; i++)
      {
              for (octave_idx_type j=0; j&lt;n; j++)
              {
                      a_matrix(i,j) = (i+1) * 10 + (j+1);
              }
  
              printf ("%d", &amp;a_matrix);
      }
      return 0;
  }
  </code></pre>
  
  <p>But I got this error</p>
  
  <blockquote>
    <p>standalone.c: In function ‘main’:<br>
    standalone.c:8: error: ‘Matrix’ undeclared (first use in this function)<br>
    standalone.c:8: error: (Each undeclared identifier is reported only once<br>
    standalone.c:8: error: for each function it appears in.)<br>
    standalone.c:8: error: expected ‘;’ before ‘a_matrix’<br>
    standalone.c:10: error: ‘octave_idx_type’ undeclared (first use in this  function)<br>
    standalone.c:10: error: expected ‘;’ before ‘i’<br>
    standalone.c:10: error: ‘i’ undeclared (first use in this function)<br>
    standalone.c:12: error: expected ‘;’ before ‘j’<br>
    standalone.c:12: error: ‘j’ undeclared (first use in this function)<br>
    standalone.c:14: warning: implicit declaration of function ‘a_matrix’ <br>
    standalone.c:17: error: ‘a_matrix’ undeclared (first use in this function)</p>
  </blockquote>