C指针1
#include <stdio.h>
#include <stdlib.h>
void reset(char x);
void rest(char *x);
int main111(void){
char a = 'a';
int b = 128;
printf("a变量的地址是:%d\n",&a);
printf("b变量的地址是:%d\n",&b);
unsigned int address = &a;
//char*是字符指针类型,int*是整形指针类型
//p1和p2是指针变量
char* p1 = &a;
int* p2 = &b;
//char c = *p1;
printf("p1变量的地址是:%d\n",p1);
printf("p2变量的地址是:%d\n",p2);
char c =20;
char* p3 = &c;
printf("c = %d\n",c);
printf("p3变量的地址是:%d\n",*p3);
//&和*是互逆远算 &获取变量的地址,*获取地址对应的变量
//这个*p1确实就是c
c = 21;
*p3 = 22;
puts("调用函数改变变量的值————————");
reset(c);
//调用函数时,参数的传递是按值传递的,这里传的是C数值给X,x并不是C
printf("c = %d\n",c);
printf("p3变量的地址是:%d\n",*p3);
rest(&c);
printf("c = %d\n",c);
}
void reset(char x){
x = 0;
}
void rest(char *x){
*x = 0;
}