程序代码:
#include <stdio.h>
struct student{
int num;
int score;
};
int main(){
struct student s[3] = {
{100,100},
{200,200},
{300,300}
};
struct student *p;
p = s;
printf("%d ",(*p).num);
return 0;
}
因为程序正确,所以这里的输出结果是100。
注意下列语句及其输出的值:
(p+1)->num 值为200
(*p++).num 值为100
*p.num 报错,因为.的优先级高于*
(*p)->num 报错,因为(*p)表示一个结构体,而不是指针
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。