In response to one of my Cboard queries I was told by a responding OP that my header file treatment was wrong. The way I did it, was conform an Internet tutorial. This is how (re below). Please tell me what is wrong and also how it should be done. I understand that the "externs" in the example signify that no memory is to be allotted. I was also told that no function definitions should be in a header file. Where then should they be defined?
Code:
//in foo.h
#ifndef temp
#define temp
extern int foo(int x)
#end if
extern int foo(int x)
{
return x+5;
}
//in main.c
#include "foo.h"
int main(void)
{
int y = foo(3);
printf("%d\n",y)
}