title: Simple guessing game that allows user to play again after correctly guessing the random number?
body: <pre><code>#include&lt;stdio.h&gt;
  #include&lt;stdio.h&gt;
  #include&lt;stdlib.h&gt;
  #include&lt;math.h&gt;
  #include&lt;time.h&gt;
  
  int random_num;
  void guessGame(int guessed_num){
  
      char answer;
  if (guessed_num == random_num){
      printf("Correct! That's the number.\n");
      printf("Would you like to play again (y or n)?\n");
      scanf("%c", &amp;answer);
      if (answer=='y')
          scanf("%d", &amp;guessed_num);
          guessGame(guessed_num);
      if (answer=='n')
          return 0;
  
  
  }
  else
      if (guessed_num &lt; random_num)
          printf("Too low. Guess again.\n");
      else
          printf("Too high. Guess again.\n");
  }
  
  int main(){
  
  int guessed_num = 0;
  srand(time(NULL));
  random_num = rand() % 50 + 1;
  
  printf("I have a number between 1-50.\n");
  printf("Can you guess what it is?\n");
  printf("Enter your initial guess.\n");
  
  while(1){
  
      scanf("%d", &amp;guessed_num);
      guessGame(guessed_num);
  }
  
  return 0;
  }
  </code></pre>
  
  <p>So after the user finds the correct random number, I want them to be able to play the game again(if they want). How do I go about having the code run all over again? I tried to do it in my guessGame function but I know it's wrong.</p>