define functions in another file
I'd like to define some functions for a program in another file as they are too long..
So, I used
but the problem comes here is that ...
# include <filename.c>
The variables that I commonly used in main and this files have to be declared before I write main()..
Is this the right way to do.
int variable; declared above the whole code..
# include <stdio.h>
I don't know whether it totally works or not.. as I am in the middle of my code. As far as I recognized is that .. its not showing the respective error.
1. If I want to define functions in some other files and include in main..
how do I do it ?
2. Actually, my function files are not located in default location..
so, I need to mention the address too..
is there any other way to do that..
# include </home/username/folder/filename.c>
what I should do .. so that I need not mention this address.
something like adding search directory to the gcc compiler for checking filess..