title: Don't understand the referencing and dereferencing for custom C datatype pointers pointing to an array
body: <pre><code>typedef struct Graph{
      int n;
      int* arr;
  } G;
  
  void main(){
      int size;
      G g1;
      int adjm[3][3]={{1,1,2},{4,5,6,},{3,0,0}};
      g1.arr=adjm;
      printf(&quot; %d&quot;,*(*(g1.arr +1)+2));
  }
  </code></pre>
  <p>This is my C code, I want to play around with custom data structures <code>struct</code> and so I declared an integer pointer inside the <code>struct Graph</code>. Now I'm creating a static multidimensional array in the <code>main</code> function <code>int adjm[3][3]</code> . When trying to acess the value from the variable <code>g1.arr</code>, I keep getting the following error.</p>
  <blockquote>
  <p>invalid type argument of unary ‘*’ (have ‘int’)</p>
  </blockquote>
  <p>I don't understand why this erro occurs as <code>g1.arr</code> is an integer pointer, and I'm simply using it as a reference to a statically declared multidimensional array <code>adjm[3][3]</code>, so shouldnt the dereferencing using <code>*</code> work here properly?</p>