I have ran into an unexpected error while running my C code. My code works perfectly fine when I put my main function last and declare no function prototypes, but it does not work fine when I put main first and declare my function prototypes.
These are the names of my functions in order:
int main(int argc, char *argv[])
{
// code here
}
int b_s(char *word, char *Table[], int n)
{
// code
}
void print(char *Table[], int n)
{
// code here
}
a
int ins(char *word, char *Table[], int n)
{
// code here
}
void empt(char *Table[], int n)
{
// code here
}
And this is how I declare my prototypes below the preprocessors:
int b_s(char *word, char *Table[], int n)
void print(char *Table[], int n)
int ins(char *word, char *Table[], int n)
void empt(char *Table[], int n)
And this is the error message I get:
In function 'b_s':|
error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int'|
error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token|
error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token|
error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token|
error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token|
error: expected '{' at end of input|
I was wondering if I am just declaring my prototypes wrong or is it something else?
Put ;
after each function declaration.like
int b_s(char *word, char *Table[], int n);