title: scanf a string in a char pointer
body: <p>I want to scan a string and point a <code>char</code> pointer to this scanned string.</p>
  
  <pre><code>int main(int argc, char *argv[]) {
  
      char *string;
      scanf("%s",&amp;string);
      printf("%s\n",string);
  
  }
  </code></pre>
  
  <p>But gives a warning saying </p>
  
  <blockquote>
    <p>warning: format '%s' expects argument of type 'char *', but argument 2
    has type 'char **'</p>
  </blockquote>
  
  <p>How do I scan a string in a <code>char *</code> without warnings.</p>
  
  <p><strong>Edit</strong> : It worked for the below code with warnings and I drilled down it to the above one so to be very specific.</p>
  
  <pre><code>int main(int argc, char *argv[]) {
  
      int n = 2;
  
      char *strings[2];
      for(int i = 0; i &lt; n; i++){
          scanf("%s",&amp;strings[i]);
          printf("%s\n",&amp;strings[i]);
      }
  
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/kgSBs.png" rel="noreferrer"><img src="https://i.stack.imgur.com/kgSBs.png" alt="enter image description here"></a></p>