I’m getting an error I don’t understand and can’t find a solution.
The error is as follows:
missing prototype for isANumber
the code it refers to is:
double prompt(char *promptString) {
printf("%s", promptString);
char *input = "";
scanf("%s", &*input);
printf("%s\n", &*input);
int check = isANumber(input);
if (check) {
return (double) *input;
} else {
return 0.00;
}
}
int isANumber(char *check) {
int result = 0; /* Current isdigit() return value */
do /* Check that each character of the...*/
result = isdigit(*check++); /* ...string is a digit and move on...*/
while (result && *check); /* ...until non-digit found or at EOS */
return result; /* Return result of last isdigit() call */
}
libraries included:
#include <stdio.h>
#include <limits.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
Any help would be appreciated 🙂
You can’t forward reference like that. You need to declare or define
isANumberbefore you can reference it:Put this before your
promptfunction: