指针

来源:互联网 发布:中银淘宝校园卡过期 编辑:程序博客网 时间:2024/05/06 13:16
本人涉世未深 多多包涵

“*”表示指针
int i=2000
int *pointer
pointer表示指针变量
pointer =&i 表示取的是2000这个数所在的地址
printf("%d",*pointer)——“*”表示取值
“&”和“*”优先级相同 但按自右向左
例如:
pointer_2和pointer_1都是指针变量
pointer_2=&*pointer_1 指的是把“*poniter_1”的值得地址赋值给pointer_2
结构体指针
struct stu
 
{
 int ia;
 int ib;
}student;
struct stu *pstu;
pstu=&student(把student的首地址赋值给pstu)

student.ia=(*pstu).ia=pstu->ia;
1 0
原创粉丝点击