Functions should always be declared with the appropriate function prototype. A function
prototype is a declaration of a function that declares the types of its parameters. If a function prototype is not available, the compiler cannot perform checks on the number and type of arguments being passed to functions. Argument type checking in C is only performed during compilation, and does not occur during linking, or dynamic loading.
...
| Code Block | ||
|---|---|---|
| ||
#include <stdio.h>
extern char *strchr();
int main(void) {
char *c = strchr(12, 5);
printf("Hello %c!\n", *c);
return 0;
}
|
C99 Section 6.11 of the C99 standards, "Future language directions", states that "The use of function declarators with empty parentheses (not prototype-format parameter type declarators) is an obsolescent feature." The use of these declarations prevents the compiler from performing type checking.
...