[C.C++] c语言调用外部c程序的函数,C语言从另一个C文件调用函数

369 0
Honkers 2025-5-25 01:26:25 来自手机 | 显示全部楼层 |阅读模式

示例

foo.h

#ifndef FOO_DOT_H    /* This is an "include guard" */

#define FOO_DOT_H    /* prevents the file from being included twice. */

/* Including a header file twice causes all kinds */

/* of interesting problems.*/

/**

* This is a function declaration.

* It tells the compiler that the function exists somewhere.

*/

void foo(int id, char *name);

#endif /* FOO_DOT_H */

foo.c

#include "foo.h"    /* Always include the header file that declares something

* in the C file that defines it. This makes sure that the

* declaration and definition are always in-sync.  Put this

* header first infoo.cto ensure the header is self-contained.

*/

#include 

/**

* This is the function definition.

* It is the actual body of the function which was declared elsewhere.

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Honkers

荣誉红客

关注
  • 4014
    主题
  • 36
    粉丝
  • 0
    关注
这家伙很懒,什么都没留下!

中国红客联盟公众号

联系站长QQ:5520533

admin@chnhonker.com
Copyright © 2001-2025 Discuz Team. Powered by Discuz! X3.5 ( 粤ICP备13060014号 )|天天打卡 本站已运行