How can I define a C function in one file, then call it from another?

前端 未结 2 470
既然无缘
既然无缘 2021-02-05 02:34

If I define a function in file func1.c, and I want to call it from file call.c. How can I accomplish this task?

2条回答
  •  Happy的楠姐
    2021-02-05 03:32

    You would put a declaration for the function in the file func1.h, and add #include "func1.h" in call.c. Then you would compile or link func1.c and call.c together (details depend on which C system).

提交回复
热议问题