My C skills are rusty, but I would try something like this to determine which ASCII character the arrow keys represent:
char c;
while (true) {
c = getchar();
println("You just pressed: %c.", c);
println("That is ascii: %d.", c);
}
Then, once you know what value the arrow keys return, you could do whatever you want when they are pressed. For example, if the up-arrow returned 201 (I don't know what it really returns):
while (true) {
c = charchar();
if (c == 201) {
variable++;
}
if (c == 'Q') {
// Quit
break;
}
}