title: Strings and character with printf
body: <p>I was confused with usage of <code>%c</code> and <code>%s</code> in the following C program:</p>
  <pre class="lang-c prettyprint-override"><code>#include &lt;stdio.h&gt;
      
  void main()
  {
      char name[] = &quot;siva&quot;;
      printf(&quot;%s\n&quot;, name);
      printf(&quot;%c\n&quot;, *name);
  }
  </code></pre>
  <p>Output:</p>
  <pre><code>siva
  s
  </code></pre>
  <p>Why we need to use pointer to display a character %c, and pointer is not needed for a string</p>
  <p>I am getting error when I run</p>
  <pre><code>printf(&quot;%c\n&quot;, name);
  </code></pre>
  <p>I got this error:</p>
  <pre><code>str.c: In function ‘main’:
  str.c:9:2: warning: format ‘%c’ expects type ‘int’, but argument 2 has type ‘char *’
  </code></pre>