Originally Posted by
revanthb3000
I was asking about the arrow keys usage. How do you get the compiler to receive the arrow keys input ? What code/function do you have to enter in the program ?
I think u want to know how the arrow keys can be sensed while running a program.
here is a simple example.
Code:
#include <stdio.h>
#include <conio.h>
int main(void)
{
unsigned char key, key2;
while( (key=getch()) != '\r' )
{
if (key == 0)
{
key2 = getch();
switch(key2)
{
case 72:
printf("up "); break;
case 75:
printf("left "); break;
case 77:
printf("right "); break;
case 80:
printf("down "); break;
default: break;
}
}
}
return 0;
}