So I'm following along in Head First C and we're on a chapter where we learn to compile multiple files together. One of them is encrypt.c
.
#include "encrypt.h"
void encrypt(char *message)
{
char c;
while (*message) {
*message = *message ^ 31;
message++;
}
}
The encrypt.h
file repeats the first line with a semicolon at the end, so why do I need it? I understand why I would need header files to fix the problem of using a function before it's defined, so I could understand #including it in a file that uses encrypt.c
, but why would I need it inside encrypt.c
? Is it just one of those "because" reasons?
typedef
s andstruct
s and all kinds of things that the functions declared in that header may want to use.