title: how to declare multidimensional array with typedef and pointer
body: <p>Now the question is about typedef and c styles strings.
  Here is the code.</p>
  
  <pre><code> #include &lt;stdio.h&gt;
   #define C "BTP300", "BTD310", "BTI320", "BTS330"
   typedef char* Course;// Line 1
   #define CMP(a,b,c,d) ((a[(c)])d(b[(c)]))
  
   int main(void) {
       Course reference, test[] = {C}; //Line 2
       sort(test,4,2);
       reference=test[0];
       difference(test, reference, 4);
       return 0;
   }
  
  
      void sort(Course a[], int n, int k) {
           int i, j;
           Course temp;
           for (i = n - 1; i &gt; 0; i--) {
               for (j = 0; j &lt; i; j++) {
                   if (CMP(a[j],a[j+1],k,&gt;)) {
                       temp = a[j];
                       a[j] = a[j+1];
                       a[j+1] = temp;
                   }
               }
           }
       }
  
   void difference(Course a[], Course reference, int n) {
       int i;
       for (i = 0; i &lt; n; i++)
           printf("%d ", ABS(a[i] - reference));
       printf("\n");
   }
  </code></pre>
  
  <p>This is what I understood:
  -Course is an alias for a pointer of char type.
  -reference is a pointer of char type.</p>
  
  <p>What I dont know or need to know the theory behind the code is:
  1- What is test[] ??? I think its an array of pointers of type char in other words test[1] contains char*="btd310" .(I dont know the reasoning of it.)</p>
  
  <p>2- how do i access the "d" in "btd310"?
  3- using typedef int* how do i create a 2 dimensional int array? I was looking for something like </p>
  
  <pre><code>typedef int* arr;
  void main(){
  arr foo[]={{1,2},{3,4}}
  }
  </code></pre>
  
  <p>Obviously above code didnt work for me so which way it will work i.e. i will get 2d int array.</p>
  
  <h1>Thanks guys in advance. And by the way, there might be better other ways to do it but i have to learn this way.</h1>
  
  <p>How the two macros in above code work? </p>