Hey guys i keep getting a warning in ansi c sayin implicit function declaration where i see nothing wrong with it. Its complaing about the MainMenu() function. Could someone give me a hand here?
Code:
#include "ts.h"
#include "ts_utility.h"
#include "ts_options.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int commandLineArguments(int, char**);
int mainMenu(int*);
int main(int argc, char** argv)
{
TennisStoreType ts;
commandLineArguments(argc, argv);
MainMenu(&main);
return EXIT_SUCCESS;
}
int commandLineArguments(int argc, char **argv)
{
/* makes a local copy of argc and **argv */
FILE *customer, *stock, *logfile;
/* declares a pointer to each file*/
/* test if 4 arguments exist including the exucutable*/
if(argc !=4)
{
printf("please enter 3 cmd arguments!\n");
return 1;
/* stop pocessing*/
}
/* attempt to open and read arg 1*/
customer = fopen(argv[1], "r");
/* check if custome.csv exists*/
if(customer ==NULL)
{
printf("cannot open %s for reading\n", argv[1]);
return 1;
/* can't go on*/
}
/* try to open stock.csv and read it*/
stock = fopen(argv[2], "r");
/* if stock.csv does not exist error*/
if(stock == NULL)
{
printf("cannot open %s for reading\n",argv[2]);
return 1;
/* stop processing*/
}
/* open logfile for reading */
logfile = fopen(argv[3], "r");
/* check if logfile exists*/
if(logfile == NULL)
{
printf("cannot open %s for reading\n", argv[3]);
return 1;
/* stop processing*/
}
/* close all files */
fclose(customer);
fclose(stock);
fclose(logfile);
return 0;
}
int MainMenu(int *c)
{
int choice = 0;
/* declare variables*/
do
{
printf("\nMain Menu:");
printf("1) Add Customer\n");
printf("2) Add Stock\n");
printf("3) Delete Record\n");
printf("4) Display Customer\n");
printf("5) Display stock\n");
printf("6) Make Sale\n");
printf("7) Sales Log\n");
printf("8) Save and Exit\n");
printf("9) Abort\n");
fscanf(stdin, "%d",&choice);
switch(choice)
{
case 1:
printf("Add stock");
break;
}
}
while(choice !=9);
/* switch case */
/* do while
/* while !=10 */
return 0;
}