#define Point_32 int*
int c;
Point_32 a,b;//相当于int* a,b
a = &c; //√
b = &c;//×
typedef int Point_32;//类型修改
typedef long long Point_64;
Point_32 a,b;//a,b都为整型指针
a = &c;
b = &c;
数组指针
int arr[3][4];
int ()p[4] = arr;p++;//p+4个int
int ()q = &arr[0];q++;//q+4个int
int *s = &arr[0][0];s++;//s+1个int
int (*w)[3][4] = &arr;w++;//w+12个int
对数组指针的重命名:typedef int (*Arr_Point)[4];
Arr_Point = arr;
指针数组
const char* arr[5] = {“hello”,“world”};
arr[0] = “aeeee”;//√
const char *p = arr[0];
指向函数的指针
int add(int a,int b){
return a+b;
}
int mul(int a;int b){
return a*b;
}
int mian(){
int a,b;
char op[10] = 0 ;
scanf(“%d&d”,&a,&b);
scanf(“%s”,&op);
//定义一个函数指针,指向add,指向mul
int (*pfun)(int int)😕/声明一个指针变量
if(strcmp(op,“+”) == 0){
pfun = add;
}
else{
pfun = mul;
}
int result = pfun(a,b);
printf(“%d”,result);
}
输入输出函数:
字符:char c = getchar();
putchar©;
int main(){
putchar(getchar());
}
字符串:
gets();
puts();
int a = 10;
int c = ‘u’;
scanf(“%d”,&a); printf(“%d\n”,a);
getchar();
scanf(“%c”,&c); printf(“%c\n”,c);