Skip to main content

Posts

Showing posts with the label The Crazy Programmer Implicit Declaration of Function in C Implicit Declaration of Function in C The Crazy Programmer

Implicit Declaration of Function in C Pratik Sah The Crazy Programmer

We are very much familiar with the flow control in C where it follows the Top-Down approach , and when we are writing a C program and if we are using any function, we might have come across a very common error ‘Implicit declaration of function’. Now why this error occurred? The answer is already in the error. We have used a function in our program which is not declared yet or we can say that we have used a function implicitly. Implicit declaration of the function is not allowed in C programming. Every function must be explicitly declared before it can be called. In C90, if a function is called without an explicit declaration, the compiler is going to complain about the implicit declaration. Here is a small code that will give us an Implicit declaration of function error. #include <stdio.h> int main(void) { int a = 10; int b = 20; printf("The value of %d + %d is %d",a, b, addTwo(10, 20)); return 0; } Now the above code will give you an error of Implicit d