title: Why the realloc did not work properly in this case?
body: <pre><code>#include&lt;stdio.h&gt;
  #include&lt;string.h&gt;
  #include&lt;stdlib.h&gt;
  
  char *func(char * str){
  
  
      int len;
      len=strlen(str)+3;
      str = (char *)realloc(str,len);
      return str;
  
  
  }
  
  void main(){
  
      printf("str:%s",func("hello"));
  
  }
  </code></pre>
  
  <p>The final ans prints (null),instead of printing the string: "hello". Can anyone please explain why is it so?
  I am unable to identify any error.
  <strong>Can anyone rectify the error, and help me with a working code. Please!</strong></p>