Tag Info

New answers tagged


I answered my own question, got rid of scanf completely. In case anyone is looking for a getint() function, feel free to use mine: http://pastebin.com/raw.php?i=TZiJvfe7 I included those 1; statements because my compiler doesn't like empty while loops. Will experiment to find another way, but this is not the point of my question. Still sometimes hangs. ...


here is one possible way to implement the function. Note the call to clear the input stream just before outputting the prompt to the user #include <stdio.h> int getint(int, int); void clearInputStream( void ); int main() { while(1) { cleanInputStream(); printf("enter an int between 0 and 10:\n"); int ans = getint(0, ...

Top 50 recent answers are included