int main() {
printf("hello world\n");
return 0;
}
When I run the above code, I get the following result. but the hello world result was output. Could you please tell me why?
hoge.c:2:5: error: call to undeclared library function 'printf' with type 'int (const char *, ...)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
printf("hello world\n");
^
hoge.c:2:5: note: include the header <stdio.h> or explicitly provide a declaration for 'printf'
1 error generated.
hello world
Top comments (2)
You are missing the library that contains that function. As states the error output you need to have the line โ#include โ at the beginning of the code file.
Hello, what code ide are you using? Also you can ask this question on stackoverflow and upload screenshots of the error so you can get help.