A function prototype is essentially a *stripped* declaration of a function that goes before the actual declaration of the function. For example, look at this piece of code:
```c
#include <stdio.h>

int main() {
  printf("%d\n", sum(1));
  return 0;
}

int sum(int x, int y) {
  return x + y;
}
```
If you look closely, you'll notice that, in the `main` function, `sum` is only called with one argument. Many compilers would happy compile this code, perhaps with a warning. For example, gcc will give you the warning `implicit declaration of function 'sum' [-Wimplicit-function-declaration]`, but proceed to yield a working executable.
When such call happens, the argument of interest(`y`, in this case), is undefined, and is likely a value on the stack(on 32-bit systems) or in one of the registers(on 64-bit system).
To avoid this behavior, you can add a **function prototype** at the top(the location actually doesn't matter, as long as its above potential callers, such as `main`!) of the file, like so:
```c
#include <stdio.h>

int sum(int, int); // This is the function prototype!

int main() {
  printf("%d\n", sum(1));
  return 0;
}

int sum(int x, int y) {
  return x + y;
}
```
As you can see, the function prototype is indeed just a stripped declaration: `int sum(int x, int y)` was turned into `int sum(int, int)`. Now, if we try compiling this code using gcc, we'll get the error `too few arguments to function 'sum'`, and no executable will be generated.

Function prototypes are a really important feature of C and should always be used to save hours of potential debugging.
spam fails_task lang_mismatch pii not_appropriate hate_speech sexual_content quality toxicity humor helpfulness creativity violence