I used the system("pause")
with stdio.h
and it worked without error. When I looked at the stdio functions, system()
is in stdlib. How come it worked, and here is the code?
#include <stdio.h>
int main() {
printf("Hello World\n" );
system("pause");
return 0;
}
The answer is that it's an implicit declaration. If the compiler doesn't see a prototype for a function, it assumes it was declared like:
int system();
If you turn up the warning level on your compiler, you'll likely see that this causes a warning. Implicit declarations are generally undesirable, but in this case it's why this works without causing any errors.