------Java培训、Android培训、iOS培训、.Net培训、期待与您交流! -------
int num;
int num2;
void test();
int main(int argc, const char * argv[]) {
extern int num;
extern int num2;
num = 10;
num2 = 12;
printf("%d %d",num,num2);
test();
return 0;
}
void test()
{
printf("%d %d",num,num2);
}
通过两个不同块的方法,说明显式的extern只是为了程序的可读性更好
#include <stdio.h>
#include <string.h>
#define TWO 2
#define FOUR TWO*TWO
#define SQUARE(x) x*x
#define PR(x) printf("is %d \n",x)
#define PR_2(x) printf("is "#x" \n")
#define XNAME(n) X##n
#define PR_CHANGE(...) printf(__VA_ARGS__)
#define MAX2(X,Y) (X>Y?X:Y)
#define ABS(X) (X<0?-X:X)
int main(int argc, const char * argv[]) {
PR(SQUARE(FOUR));
PR_2(8);
PR_2(SQUA