title: My Program works fine, but while compiling it warns -Wwritable-strings
body: <p>My Program works fine, but while compiling it shows a warning that:
  "ISO C11 does not allow conversion from string literal to 'char *' [-Wwritable-strings]
          list.get_string("Enter a String: ");"</p>
  
  <p>The code goes like this: </p>
  
  <pre><code>char * getString(char *str)
  {
      int ch, i;
      char *ptr = malloc(sizeof(int) * sizeof(char) + 1);
      i=0;
      printf("%s", str);
      while((ch=getchar())!='\n')
      {
          ptr[i] = ch;
          i++;
      }
      return ptr;
  }
  </code></pre>
  
  <p>Why is it showing a warning in my code? 
  Also, the code looks a little bit messy. Is there a better way of writing this code?</p>