Originally Posted by
suryak
instead of building mod1.c and mod2.c ..
I made mod1.h and mod2.h
added
#ifndef mod1_H
#define mod1_H
and at the end, i added
#endif
and in the main.c ..
I add
# include <mod1.h>
# include <mod2.h>
This might be correct, but generally, it isn't. Normally, we would do something like this:
Code:
#ifndef FOO_H
#define FOO_H
/* foo.h */
void foo(int n);
#endif
Code:
/* foo.c */
#include <stdio.h>
void foo(int n)
{
printf("This is foo: %d\n", n);
}
Code:
/* main.c */
#include <stdio.h>
#include "foo.h"
int main(void)
{
printf("%s\n", "Hello world!");
foo(123);
return 0;
}
Originally Posted by
suryak
when I complile .. its showing " no such file or directory found.."
what's the problem..how do i fix it.
Refer to the link in my post #5.