The implicit declaration of function error is very common in C language. Either you are a beginner in C or moved to C from a high-level language. C is procedural programming language. So it is very important to declare every function before using. The flow control works on Top-Down basis.
int main() { callit(1, "12"); /* Declare that function before using it */ return 0; } int callit(int x, char *p) { /* Some Code */ }The actual error message is
warning: implicit declaration of function
What causing Implicit declaration of function error in C?
This error will generally show the name of the function in the compiler. You are using the function without declaring it. A more in-depth solution Implicit declaration of function in C is available here.
Solution of Implicit declaration of function
1) If you are using pre-defined function then it is very likely that you haven’t included the header file related to that function. Include the header file in which that function is defined.
#include <unistd.h>2) If you are using any custom function then it is a good practice to declare the function before main. Sometimes the problem comes due to the return type of the function. By default, C language assumes the return type of any function as ‘int’. So, declare the function before main, that will definitely resolve that issue.
int callit(int x, char *p); /* Declare it in this way before main */Final Words
If you are still getting any problem, then feel free to comment down your code.