By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,204 Members | 1,161 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,204 IT Pros & Developers. It's quick & easy.

Implicit Declaration of Function Printf()

P: 1
When i try to compile the following program, it says
"warning: implicit declaration of function 'printf'"
Heres the source code

Expand|Select|Wrap|Line Numbers
  1. #include <stdio.h>
  3. int main(void)
  4. {
  5.     prinf("Hello World");
  6.     return 0;
  8. }
Nov 15 '15 #1
Share this Question
Share on Google+
4 Replies

P: 22
Two reasons i can think of
1. In your actual source code you have not included
Expand|Select|Wrap|Line Numbers
  1. #include <stdio.h>
2. The installation is not proper and the compiler is not able to find the stdio.h file or may be it is pointing to different stdio.h file
Nov 15 '15 #2

Expert Mod 5K+
P: 9,197
Actually, it's printf not prinf.
Nov 15 '15 #3

P: 22
In the warning message it correctly refers to, I was not sure which is correct?
Nov 16 '15 #4

Expert Mod 5K+
P: 9,197
An implicit declaration means to call a function without previously telling the compiler that this is a valid function. You tell the compiler the function is valid by a)coding the function before you call it the first time or b)using a function prototype if the code for the function does not appear before the first call.

There is no way that the compiler would know you meant printf when prinf is a perfectly good function name.

Maybe you could post your warning.
Nov 16 '15 #5

Post your reply

Sign in to post your reply or Sign up for a free account.