title: Returning string from C function
body: <p>I haven't used C in over 3 years, I'm pretty rusty on a lot of things.</p>
  
  <p>I know this may seem stupid but I cannot return a string from a function at the moment. Please assume that: I cannot use <code>string.h</code> for this. </p>
  
  <p>Here is my code: </p>
  
  <pre><code>#include &lt;ncurses.h&gt;
  
  char * getStr(int length)
  {   
      char word[length];
  
      for (int i = 0; i &lt; length; i++)
      {
          word[i] = getch();
      }
  
      word[i] = '\0';
      return word;
  }
  
  int main()
  {
      char wordd[10];
      initscr();
      *wordd = getStr(10);
      printw("The string is:\n");
      printw("%s\n",*wordd);
      getch();
      endwin();
      return 0;
  }
  </code></pre>
  
  <p>I can capture the string (with my <code>getStr</code> function) but I cannot get it to display correctly (I get garbage).</p>
  
  <p>Help is appreciated. </p>