bool print_date(Date *d, char **argv) {
if (isdigit(*argv+1)) {
return printf("is d");
} else {
return printf("is not d");
}
}
The above function don’t work. *argv+1 is the user input, is it a string or what types when passing in? anyone can help?
int main(int argc, char *argv[])
{
Date d;
get_date(&d, argv);
}
*argv+1computes the address to the first character of the 0-th argument (that is the executable name) and adds 1 to shift to second char of it.. I don’t think this is what you want to do.You could try by using
argv[1], this will mean the first argument after the executable name, as achar *.