Here we have three files
1. demo.h includes the header file and function declaration
2. demo.c includes the function definition
3. main.c includes the header to call function and function call
1. demo.h includes the header file and function declaration
2. demo.c includes the function definition
3. main.c includes the header to call function and function call
demo.h
#ifndef
DEMO_H_ /* Include guard */
#define DEMO_H_
int functiontest(int x); /* An example function declaration */
#endif
#define DEMO_H_
int functiontest(int x); /* An example function declaration */
#endif
__________________________________________________________________
demo.c
#include
"demo.h" /* Include the header (not strictly necessary here) */
int functiontest(int x) /* Function definition */
{
return x + 5;
}
int functiontest(int x) /* Function definition */
{
return x + 5;
}
___________________________________________________________________
main.c
#include
<stdio.h>
#include "demo.h" /* Include the header here, to obtain the function declaration */
int main(void)
{
int y = functiontest(4); /* Function call */
printf("%d\n", y);
return 0;
}
#include "demo.h" /* Include the header here, to obtain the function declaration */
int main(void)
{
int y = functiontest(4); /* Function call */
printf("%d\n", y);
return 0;
}
my friend it really works...... i like ur blog so much. It provide very useful information........
ReplyDelete