Hi there. I'm new to the forum ;-)
I'm having really a bad time with the scanf(9 function. Take a look at this:
That is supposed to take some input from the user. The proble is that when I execute it, here's what I get:
Basically, it skeeps the 2nd and the 4th scanf(). I can't see any reason for that. I don't think it's a bug in gcc (the compiler i'm using)...
Thanks in advance. That's really gonna drive me crazy :(
I'm having really a bad time with the scanf(9 function. Take a look at this:
Code:
#include <stdio.h> int main() { char up_key, down_key, right_key, left_key; int speed; printf("**** Configurazione delle opzioni ****\n"); printf("Immetti il valore up_key: "); scanf("%c", &up_key); printf("Immetti il valore down_key: "); scanf("%c", &down_key); printf("Immetti il valore right_key: "); scanf("%c", &right_key); printf("Immetti il valore left_key: "); scanf("%c", &left_key); printf("Immetti il timeout del gioco (più è alto, più il gioco è lento): "); scanf("%d", &speed); }
Code:
**** Configurazione delle opzioni **** Immetti il valore up_key: e Immetti il valore down_key: Immetti il valore right_key: e Immetti il valore left_key: Immetti il timeout del gioco (più è alto, più il gioco è lento): 5
Thanks in advance. That's really gonna drive me crazy :(
Comment