title: utility of #define in c++
body: <p>I just found out this code from a tutorial for matrix addition in c++ by reading the values from a file-</p>
  <p>I wanted to ask what does #define does here? What is so special in it? And how is it different from separately declaring M and N as int or char in main?</p>
  <p><strong>code</strong></p>
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  using namespace std;
  
  #define M 4
  #define N 5
  
  void matrixSum (int P[M][N], int Q[M][N], int R[M][N]);
  void matrixSum (int P[M][N], int Q[M][N], int R[M][N]) {
   for (int i=0; i&lt;M; i++)    // compute C[][]
    for (int j=0; j&lt;N; j++) 
      R[i][j] = P[i][j] + Q[i][j];
  }
  
  int main () {
  
   ifstream f;
   int A[M][N];
   int B[M][N];
   int C[M][N];
  
      f.open(&quot;values&quot;);   // open file
  
      for (int i=0; i&lt;M; i++)     // read A[][]
        for (int j=0; j&lt;N; j++) 
          f &gt;&gt; A[i][j];   
  
      for (int i=0; i&lt;M; i++)     // read B[][]
        for (int j=0; j&lt;N; j++) 
          f &gt;&gt; B[i][j];
  
      matrixSum (A,B,C);      // call to function
  
      for (int i=0; i&lt;M; i++) {   // print C[][]
        for (int j=0; j&lt;N; j++) 
          cout &lt;&lt; C[i][j] &lt;&lt; &quot; &quot;;
        cout &lt;&lt; endl;
      }
      f.close();
  }
  </code></pre>