Hi everyone. I've just begun picking up C today (with the ultimate goal of using the SDL library). As I'm moving along here, I'm beginning to notice some "missing prototype" warnings, for functions that should normally be working fine. First, the code:
Code:
#include <stdio.h>
#include <string.h>
/*char *lower(char upper[]) {
char[sizeof(upper)] duplicate;
for(i=0;i<sizeof(upper),i++) {
duplicate[i] = tolower(upper[i]);
}
}*/
int execFunction(char *func) {
printf("Executing function \"%s\"...\n", func);
char *lower = strlwr(func);
if(func == "help") {
system("cls");
printf("--+HELP+--\n\n");
printf("... Basically, there is no help.\nThe only function offered right now is this one.\n");
printf("Thanks :)");
getchar();
system("cls");
}
else {
printf("Sorry, that's not a function.");
getchar();
return -1;
}
return 0;
}
/* entry point */
int main(void)
{
char input[127];
int running = 0;
printf("This is teh program! Type help for commands n' stuff.");
gets_s(input, 127);
execFunction(input);
while(running == 0)
{
gets_s(input, 127);
running = execFunction(input);
}
return 0;
}
And the errors:
warning #2027: Missing prototype for 'strlwr'.
error #2168: Operands of '=' have incompatible types 'char *' and 'int'.
warning #2027: Missing prototype for 'system'.
warning #2027: Missing prototype for 'gets_s'.
(Don't worry about that error, I'll worry about it later.)
Anyhow, as you can see, it seems some of the most basic functions are being taken as missing prototypes. What am I doing wrong here?
Thanks in advance.
~TGP1994