title: Difference between char* and char[] in C
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1880573/c-difference-between-char-var-and-char-var">C - Difference between &ldquo;char var[]&rdquo; and &ldquo;char *var&rdquo;?</a>  </p>
  </blockquote>
  
  
  
  <p>I have written the following C code</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  int main()
  {
      char name[31];
      char *temp;
      int i ;
      scanf("%s",name);
      temp  = name;
      name = temp;
  
  }
  </code></pre>
  
  <p>I got the following error when compiling </p>
  
  <pre><code>incompatible types when assigning to type 'char[31]' from type 'char *'
  </code></pre>
  
  <p>Array name is a pointer to first element(here char pointer ..right?). right?The above code  means that character array and char* are different types ..Is it true?
  Why type of name != char *
  why i cannot assign another char pointer to a char pointer(array name)</p>