久违的更新之链接
一个c文件调用另一个c文件的方法,如何找到?
hello.h
#ifndef HELLO
#define HELLO
int fn_c(int x_local);
#endif
hello.c
/* 这是一个存在于程序别处的某个全局变量的声明 */
extern int z_global;
/* 这是一个函数的定义,函数参数可以认为是局部变量 */
int fn_c(int x_local)
{
return (z_global + x_local);
}
hello_main.c
#include"hello.h"
#include<stdio.h>
int z_global = 1;
int main(int argc, char *argv[])
{
printf("%d", fn_c(10));
return 0;
}