-1

I declared the 'GuGuDan' fn in the first place before main fn, but it showed the error message 'Implicit declaration of function 'GuGudan' is invalid in C99' and didn't work. so I tried to find another solution and figured it out it works if I declare it in 'WhatToPrint' fn.

#include <stdio.h>

void GuGuDan(int, int);
void WhatToPrint(int, int);


...


void WhatToPrint(int x, int y){
void GuGudan(int, int); 
// why must I declare GuGuDan fn in WhatToPrint fn?
...

}

1 Answers1

0

In the declaration you only specify the data typed but in the definition, you need to give the variables to it. So if you do it like below it should work.

#include <stdio.h>

void GuGuDan(int, int); //this is the declaration 
void WhatToPrint(int, int);


...


void GuGudan(int x, int y){
// This way your GuGudan function will work
...

}
void GuGudan(int x, int y){
// This way your GuGudan function will work
...

}
harisu
  • 1,376
  • 8
  • 17