|
| chrisname (1342) | |||||
| Is using extern a valid and reliable way to have a function in one file access another? Or would I be much better off to make a header file which contains this? For example: main.c
difference.c:
It would be compiled with gcc -o differences main.c difference.c.Would this be a valid way of using difference()? Or would I be better off prototyping it in a header? I'd rather use externs if possible, as it keeps the amount of files down... | |||||
Last edited on | |||||
| firedraco (2048) | |
I would put it in a header, so then you don't have to go to every program that uses that .c and change the extern(s). | |
| jsmith (3099) | |
| Headers are better. Only one place to change the prototype then if the function changes. | |
| chrisname (1342) | |
| Oh, I didn't think of that! Thanks :) | |
Registered users can post in this forum.
