>Ok I am learning how to put functions that i write into a header file
Don't put definitions in a header -- only declarations. I'd recommend something like this.
myfunctions.h:
Code:
#ifndef MYFUNCTIONS_H
#define MYFUNCTIONS_H
int rndNumber(int range);
void quit(void);
#endif
myfunctions.c:
Code:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <conio.h>
#include "myfunctions.h"
int rndNumber(int range)
{
int x;
srand((unsigned)time(NULL));
x = rand()%range;
return x;
}
void quit(void)
{
printf("Press q to quit.....");
lbl1:
while(kbhit() == 0);
if(getch() != 'q')
goto lbl1;
}
main.c:
Code:
#include <stdio.h>
#include "myfunctions.h"
int main(int argc, char *argv[])
{
int x = rndNumber(6);
printf("The random number is %i\n",x);
quit();
return 0;
}