title: simply accessing char array in a function by char pointer
body: <p>in this program i am accessing a global <strong>char array</strong> through a function pointer,changing string values with <strong>address by address in char pointer</strong> makes difference in global char array , but when changing the string as whole string it does't make any difference in the global array</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  
  void function(char *string);
  
  char str[20] = "Hello"; // global char array
  
  int main()
  {
      function(str);
      return 0;
  }
  
  void function(char *string)
  {   
      int i;
  
      printf("%s\n",string);
      printf("%s\n", str);
  
      for(i = 0;i &lt; strlen(string);i++)
          string[i] = 'a';    
  
      printf("%s\n",string);
      printf("%s\n", str);
  
      string = "jhony";
  
      printf("%s\n",string);
      printf("%s\n",str);        // here is the doubt 
  }
  </code></pre>
  
  <p><strong>output</strong></p>
  
  <pre><code>Hello
  Hello
  aaaaa
  aaaaa
  jhony
  aaaaa //how this supposed to print aaaaa even after we changed string into jhony 
  </code></pre>