title: Store returned array from a function
body: <p>I am just trying to make a simple two player game. First player enters the movie and second player guesses it by using some basics of C++.</p>
  
  <pre><code>movie[] = entered by player 1.
  movie_temp[]= a temp array with '_' in it. It updates after every guess by player 2.
  </code></pre>
  
  <p>MY PROBLEM: Please refer the main function where I called the function <code>movie_check()</code>.
  This updates the life after every guess. I want the same to happen for my <code>movie_temp array</code>.
  When I run this program, only the lives are updated properly, on correct guess the lives are not reduced, but in next turn the <code>array_temp</code> is not updated and the same array is displayed again and again after each gas.</p>
  
  <p>Please help me to create a function which helps to return array and save it in <code>movie_temp</code> (just as I did for life).</p>
  
  <p>IDE: Code::Blocks
  Compiler: GCC Compiler</p>
  
  <pre><code>#include&lt;iostream.h&gt;
  #include&lt;stdlib.h&gt;
  #include&lt;ctype.h&gt;
  #include&lt;string.h&gt;
  #include&lt;conio.h&gt;
  
  void display_movie(char movie_temp[], int);
  void display_life(int);
  int win_player2(char movie_temp[]);
  int check_life(char movie[], char, int);
  
  
  void display_movie(char movie_temp[], int len)
  {
      for(int i=0 ; i&lt;len ; i++)
          cout&lt;&lt;movie_temp[i];
  }
  
  void display_life(int life)
  {
      for(int i=0 ; i&lt;=life ; i++)
          cout&lt;&lt;"\3";
  }
  
  
  int check_life(char movie[], char ch, int life)
  {
      int count1=0;
      for(int i=0 ; movie[i]!='\0' ; i++)
      {
          if(movie[i]==ch)
              count1++;
      }
      if(count1==0)
          return --life;
      else
          return life;
  }
  
  int win_player2(char movie_temp[])
  {
      int count=0;
      for(int i=0 ; movie_temp[i]!='\0' ; i++)
     {
         if(movie_temp[i]=='_')
             count++;
     }
     if(count==0)
          return 0;
     else
          return 1;
  }
  
  
  int main()
  {
      char movie[100], movie_temp[100], ch;
      cout&lt;&lt;"Enter the movie: ";
      cin.getline(movie,100);
      int len= strlen(movie);
      system("cls");
  
  
      for(int i=0 ; movie[i]!='\0' ; i++)
      {
          if(movie[i]=='a' || movie[i]=='e' || movie[i]=='i' || movie[i]=='o' ||
          movie[i]=='u' || movie[i]==' ')
              movie_temp[i]= movie[i];
          else
              movie_temp[i]='_';
      }
  
      int life=9;
      cout&lt;&lt;"\nLives left: ";
      display_life(life);
  
  
      while(life!=0 || win_player2(movie_temp)!=0)
      {
          cout&lt;&lt;"\n";
          display_movie(movie_temp, len);
          cout&lt;&lt;"\nEnter your guess: ";
          cin&gt;&gt;ch;
          life=check_life(movie, ch, life);
          cout&lt;&lt;"\n\nLives left: ";
          display_life(life);
  
      }
      getch();
      return 0;
  }
  
  enter code here
  </code></pre>