when I try to run this program it gives me an error message saying "segmentation fault". Any insight would be greatly appreciated. It compiles with gcc just fine. But I did not get this error when I compiled and ran it with Dev-C++.
thanks in advanceCode://///////////////////////////////////////////////////////////////////////////// // // Name: Sean Todd // Date: Feb 14, 2005 // Desc: this program asks a usr to enter an int and tells the usr if it //is between 5 and 10 and also checks to see if valid data was entered // ////////////////////////////////////////////////////////////////////////////// #include <stdio.h> #include <ctype.h> int main(void) { char input; printf("\nName: Sean Todd"); printf("\nPlease enter an integer: "); scanf("%c", input); if(!isalnum(input)) { printf("\nNo Data Could Be Read"); } else if(!isdigit(input)) { printf("\nData Was NOT an Integer"); } else if(input > 53 && input <=57) { printf("\nThe Number, %c is between 5 and 10", input); } else { printf("\nThe Number, %c, is NOT between 5 and 10", input); } printf("\n\n"); return 0; }//end of main
-Sean