title: Store pointer value
body: <p>As I know, when a pointer is passed into a function, it becomes merely a copy of the real pointer. Now, I want the real pointer to be changed without having to return a pointer from a function. For example:</p>
  
  <pre><code>int *ptr;
  
  void allocateMemory(int *pointer)
  {
       pointer = malloc(sizeof(int));
  }
  
  allocateMemory(ptr);
  </code></pre>
  
  <p>Another thing, which is, how can I allocate memory to 2 or more dimensional arrays? Not by subscript, but by pointer arithmetic. Is this:</p>
  
  <pre><code>int array[2][3];
  array[2][1] = 10;
  </code></pre>
  
  <p>the same as:</p>
  
  <pre><code>int **array;
  *(*(array+2)+1) = 10
  </code></pre>
  
  <p>Also, why do I have to pass in the memory address of a pointer to a function, not the actual pointer itself. For example:</p>
  
  <p>int *a;</p>
  
  <p>why not: </p>
  
  <pre><code>allocateMemory(*a) 
  </code></pre>
  
  <p>but</p>
  
  <pre><code>allocateMemory(a)
  </code></pre>
  
  <p>I know I always have to do this, but I really don't understand why. Please explain to me.</p>
  
  <p>The last thing is, in a pointer like this: </p>
  
  <pre><code>int *a;
  </code></pre>
  
  <p>Is a the address of the memory containing the actual value, or the memory address of the pointer? I always think a is the memory address of the actual value it is pointing, but I am not sure about this. By the way, when printing such pointer like this:</p>
  
  <pre><code>printf("Is this address of integer it is pointing to?%p\n",a);
  printf("Is this address of the pointer itself?%p\n",&amp;a);
  </code></pre>