so i have this code, which is supposed to get coordinates from user:
#include <stdio.h>
#include <time.h>
int main() {
int number;
char letter;
int points = 3;
while(points < 8){
printf("give me first coordinate (letter)");
scanf("%c",&letter);
printf("give me second coordinate (number)");
scanf("%d",&number);
}
}
as far as i know, this should keep taking coordinates from a user, but instead it takes it only once, and then crush in a really weird way, like it's skipping scanf without any reason. here's my output:
give me first coordinate (letter)a
give me second coordinate (number)1
give me first coordinate (letter)give me second coordinate (number)12
give me first coordinate (letter)give me second coordinate (number)df
give me first coordinate (letter)give me second coordinate (number)give me first coordinate (letter)give me second coordinate (number)sss
I feel really confused, since this is simple code, and i don't have the slightes idea whats causing this. anybody?(if it makes any difference, my system is mountain lion)