1.#define定义常量和宏
#define MAX(X,Y) (X>Y?X:Y)
int Max(int x, int y)
{
if (x > y)
return x;
else
return y;
}
int main() {
int a = 10;
int b = 20;
int max1 = Max(a, b);//函数
int max2 = MAX(a, b);//宏
printf("%d\n", max1);
printf("%d\n", max2);
return 0;
}
2.指针
int main() {
int a = 10;
int* p = &a;
*p = 20;//解引用操作符
printf("%p\n", p);
printf(" % d\n", *p);
return 0;
}