Suppose input is given from the keyboard: When you give 'a' as input and press enter,
getchar() returns the first character in the input buffer (i.e. c = 'a'), and removes it from the input buffer. But other character (i.e. '\n') is still in the input buffer. c is checked with '\n' 'a' != '\n' and fun() is called again but now '\n' was already present in the input buffer so c = '\n'. The condition is checked again to be false. Thus '\n' is printed followed by 'a' from first call to fun(), followed by '\n' from main().Output: 2 lines first blank second has character a
'\n'--> blank line
a
If input is given as abc then '\n' Output: 2 lines first blank second has characters cba
'\n' --> blank line
cba