Hello,
I can't seem to correctly use isdigit(). I have a variable that is assigned the value of argv[1], a value from the command-line. I want to check to see if that value is an integer or not. Here is what I have:
But not matter the value of myVar, be it "12" or "abcd", it keeps returning 0 for isdigit(). Any help? Like I said above, basically I am just trying to figure out if the value of argv[1] is a number or not.Code:#include <ctype.h> [...] if(isdigit(myVar) == 0) { printf("myVar is not a digit."); } else { printf("myVar is a digit."); }
Thanks!