This is used to clear the buffer memory...for eg.we use flush(stdin) before the getch() command and scanf command so as to clear the memory space...sometimes it happens that getch() takes 'enter' as a character ...to avoid this we use the flush functions.