I am trying to wrote code that DOES NOT utilize pointers (that is another similar program for later) and has to use getchar
to print in reverse whatever is input by user. So I first was trying to figure out how to use getchar to print exactly what was input. I am getting an infinite loop. Can someone tell me why??
Just what am I doing wrong here???

Code:
#include <stdio.h>

#define N 50

main()
{

  char ch;
  int i;
  
  printf("Enter in any message.\n");

  for (i=0; i < N; i++)
    {
      ch = getchar();
      while (ch != '\n')
        putchar(ch);
    }
  printf("\n");

 return 0;
}