title: When to use * in pointer assignment?
body: <p>As I'm learning C I often see pointers. </p>
  
  <p>I get that a pointer is holding the hexadecimal value of a distinct location in memory. So a pointer is nothing other than e.g.:<code>0x7fff5fbff85c</code></p>
  
  <p>Every pointer is also of a distinct type.</p>
  
  <pre><code>int var = 10;
  int *ptr = &amp;var;
  </code></pre>
  
  <p>Ptr here points to the location of var. To get the value of var I have to dereference the pointer with <code>*ptr</code>. 
  Like</p>
  
  <pre><code>printf("Var = %d", *ptr);
  </code></pre>
  
  <p>would print `Var = 10;</p>
  
  <p>However If I do a non inline declaration of a pointer like:</p>
  
  <pre><code>int var = 10;
  int *ptr;
  ptr = &amp;var;
  </code></pre>
  
  <p>I don't have to use the <code>*</code> in the third line when I'm actually assigning the memory adress to the pointer. 
  But when I got a function that takes a pointer:</p>
  
  <pre><code>int var = 10;
  void assignPointer(int *ptr) {
  *ptr = 10;
  }
  </code></pre>
  
  <p>Oh, wait! As I'm writing this I recognized that there are two different assignments for pointers:</p>
  
  <pre><code>*ptr = 10;
  </code></pre>
  
  <p>and</p>
  
  <pre><code>ptr = &amp;var;
  </code></pre>
  
  <p>What is the difference? Am I in the first case first dereferencing the pointer, assigning 10 to the location that its holding?
  And in the second case I'am assigning the actual location to the pointer.</p>
  
  <p>I'm a little bit confused when to use the * and when not to in terms of assignment. </p>
  
  <p>And if I'm working with arrays, why do I need pointers at all?</p>
  
  <pre><code>int array[];
  </code></pre>
  
  <p>"array" here is already holding the hexadecimal memory location. Doesn't that make it a pointer? So If I wanted to assign something to array wouldn't I write:</p>
  
  <pre><code>*array = [10, 2];
  </code></pre>
  
  <p>First I'm dereferencing, then I'm assigning.</p>
  
  <p>I'm lost :(</p>
  
  <p>EDIT: Maybe it's a bit unclear.
  I don't know when you have to use a * when you are working with pointers an when not. 
  Everything that is carrying a hexadecimal is a pointer right? 
  The variable name of an array is carrying it's hexadecimal memory location. So why isn't it a pointer?</p>
  
  <p>EDIT2: Thank you people you helped me a lot!</p>