How do I delimit a single character with scanf?
Code:
#include <stdio.h>
int main{
char move;
scanf ("%c",&move");
switch (move)
case w: {y-move +=1; movechar();break;}
case a: {x-move -=1; movechar();break;}
case s: {y-move -=1; movechar();break;}
case d: {x-move +=1; movechar();break;}
return 0;
}
Sorry, it's my first time here as a member but i've been using this site to selfteach C programming. Not sure if I posted the thread right but if I did make a mistake to the post please correct me.
Im making a small game where it requires movement of a piece with (w,a,s,d) keys.
I've read about delimiters in strings, where you can use it to stop scanning when a certain key is pressed.
here's my question.
how do I do that same operation with the line 4(scanf): if w,a,s, or d is pressed immediately enter the following key. (without physically pressing enter everytime. the key is immediately registered and moves on to the next line)