If I hit the space bar then it should enter the loop and execute functionality... The below code is for enter. Please let me know how to do the same with space bar hit
#include <stdio.h>
int main()
{
char ch;
//infinite loop
while(1)
{
printf("Enter any character: ");
ch=fgetc(stdin);
if(ch==0x0A)
{
printf("ENTER KEY is pressed.\n");
break;
}
else
{
printf("%c is pressed.\n",ch);
}
ch=getchar();
}
return 0;
}