title: Failing to return a string from a function
body: <p>I cant get it to work. I build a string and cant to return it, I tried to tweak with pointers but it didnt work too. Details in the code:</p>
  <pre><code>char* replace(const char* sSource, unsigned int nSearch, unsigned int nReplace)
  {
     char str[strlen(sSource)+1];
  
     \\filling str and putting '\0' at the end......
  
     return str;  // At this point str = &quot;abgde3&quot;  TRYING TO PRINT STR INSIDE THE FUNCTION WORKS !
  }
  
  </code></pre>
  <pre><code>int main()
  {
      printf(&quot;%s&quot;, replace(&quot;A39a933Ab&quot;,93,314));
      return 0;
  }
  </code></pre>