How to use kbhit and getch (C programming) [closed]

No need to explain, the code talks better :

#include <conio.h>

// ...

printf("please press P key to pause \n ");

int key = 0;

while(1)
{
    if (_kbhit())
    {
      key =_getch();

      if (key == 'P')
        break;
    }    
}

Leave a Comment