0

I have some warnings that I do not know how to resolve, here is my output.

main.c:22:9: warning: implicit declaration of function 'help' is invalid in C99
      [-Wimplicit-function-declaration]
        help();
        ^

I have stated help() in a switch case statement along with other functions:

 case 1:
        run();
        break;
 case 2:
        help();
        break;
 case 3:
        end();
        break;
 default:
        printf("Something went wrong...\n");

These functions are then written in a separate file, cases.c:

void help()
{
  int i;
  char *msg[80] = 
  {
    "THIS PROGRAM STARTS A SIMPLE WEB-SERVER. FOR TESTING, DEBUGGING, AND ETC.",
    "SIMPLY PRESS 1 TO RUN A SERVER ON LOCALHOST"
  };
  printf("%d\n", i);
}

Help would be greatly appreciated, thx!

  • Hi, perhaps create a header file with the declaration of `void help();` – IronMan Oct 10 '20 at 01:33
  • ok so lets say i create a file named A.h, and included it as ' #include ', what in the world would I write in that file? sorry if its a stupid question. – Tyson Boring Oct 10 '20 at 01:37
  • Just the declaration: `void help(void);`. Functions have to be declared before calling them. You can just declare them at the top of your `.c` file, or simply move the function to the top – Elias Van Ootegem Oct 10 '20 at 02:18

0 Answers0