my code is
void doc(){
//mycode
return;
}
my warning is
conflicting types for 'doc'
can anybody solve it.
In C, if you don't have a prototype for a function when you call it, it is assumed to return an int
and to take an unspecified number of parameters. Then, when you later define your function as returning void
and taking no parameters, the compiler sees this as a conflict.
Depending upon the complexity of your code, you can do something as simple as moving the definition of the function before its use, or add the function declaration in a header file and include it.
In any case, the net effect should be to make the function prototype available before it is being used.
If you add
void doc(void);
before the function use, you will have a prototype visible in scope, and your warning will go away.
I think this is the most likely cause for your warning. You could have an explicit incompatible declaration of doc
in your code, but we can't tell because you have not posted complete code.
try writing your doc function before your main function in your program file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With