title: Changing the memory location of constant pointer
body: <p>I have program </p>
  
  <pre><code>void alloc(char **p)
  {
       *p=(char*)malloc(sizeof(char)*3);
          (*p)[0]='a';
      (*p)[1]='f';
      (*p)[2]='\0';
  
  }
  main()
  {
      char p[]="hrrgr";
      alloc(&amp;p);
  
      printf("%s",p);
  }
  </code></pre>
  
  <p>It prints nothing. Please explain this.
  I know by passing char*p ; and alloc(&amp;p) will do the trick. But the purpose of my question is to understand the output I am getting.</p>