static extern函数
来源:互联网 发布:《人生》知乎 编辑:程序博客网 时间:2024/05/20 14:41
1. mylib.h
#ifndef MYLIB_H_#define MYLIB_H_extern int acc_add(int n); //defined in other files#endif /* MYLIB_H_ */
2. mylib.c
#include<stdio.h>#include<stdlib.h>// can only be accessed in the filestatic void show_location(){puts("shanghai");}//by default, extern int acc_add(int n)int acc_add(int n){show_location();static int total = 0;printf("before exec, total = %d, n = %d\n", total, n);total += n;return total;}
3. main.c
#include <stdio.h>#include <stdlib.h>#include "mylib.h"int main(void) {printf("acc_add(1) = %d\n", acc_add(1));printf("acc_add(1) = %d\n", acc_add(1));//show_location(); //errorreturn EXIT_SUCCESS;}
- static extern函数
- static & extern 修饰函数
- static和extern修饰函数
- static和extern对函数的作用
- static extern
- static && extern
- extern && static
- extern static
- extern static
- extern static
- extern static
- extern static
- extern & static
- extern/static
- 052.Static Extern 内部函数与外部函数
- 052.Static Extern 内部函数与外部函数
- static extern修饰变量与函数的理解
- 指针、枚举、数组、typedef、内联函数、define、extern、static变量
- SMB 3.0新特性与概述
- 基数+快速排序
- 获取虚函数指针
- 网络设备驱动
- c++中的值传递
- static extern函数
- 一个for_each用法小例子
- 集合框架(四)——Collection 子集 ——————Set及其 小弟们!
- 二分查找
- 编程之美——3.10 分层遍历二叉树
- 条款40:明智而审慎地使用多重继承
- 2012天津赛区网络赛第五题---A very hard mathematic problem(hdu4284)
- 提桶和管道的故事
- 快排