title: Assigning strings to pointer in C Language
body: <p>I am a new learner of C language, my question is about pointers. As far I learned and searched pointers can only store addresses of other variables, but cannot store the actual values(like integers or characters). But in the code below the char pointer c actually storing a string. It executes without errors and give the output as 'name'.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  main()
  {
      char *c;
      c="name";
      puts(c);
  }
  </code></pre>
  
  <p>can anyone explain how a pointer is storing a string without any memory or if memory is created where it is created and how much size it can be created.</p>
  
  <p>I tried using it with the integer type pointer</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  main()
  {
      int *c;
      c=10;
      printf("%d",c);
  }
  </code></pre>
  
  <p>But it gave an error</p>
  
  <pre><code>cc     test.c   -o test
  test.c: In function ‘main’:
  test.c:5:3: warning: assignment makes pointer from integer without a cast   [enabled by default]
  c=10;
  ^
  test.c:6:2: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘int *’ [-Wformat=]
  printf("%d",c);
  ^
  </code></pre>
  
  <p>Pointers stores the address of variable then why is integer pointer different from character pointer.</p>
  
  <p>If there is something I am missing about pointers plz explain.</p>