#include <stdio.h>
int main () 
{ 
  int c; 
  while ((c = getchar ()) != EOF) 
    { 
      putchar (c); 
      printf ("*"); 
    }
  return 0; 
}
when I run this program, the output I get is as
qwerty                                          
q * w * e * r * t * y *
* 
#I'm not getting how this last "*" is getting printed.
It has something to do with the return of putchar(). So how does putchar() function actually returns. I know that it returns after EOF is reached, so in that case, it won't print anything and printf("*") will get executed. But the thing is, why the last * is getting printed in the next line. Is it like putchar() returns and shift the printing pointer to new line?
One theory I get over this doubt is that, if I don't press 'enter' after giving input, * will not be printed. But it again created a question as of how do I get output (after giving the input), without pressing enter? And why is it like that the last * is there due to pressing 'enter'?