-->
当前位置:首页 > 题库

PROGRAMMING:Struct pointer

Luz5年前 (2021-05-10)题库360
Analyze the following code to understand the structure pointer
```
#define FORMAT "Number=%d Name=%s Sex=%c Score=%lf\n"
struct stu{
int num;
char name[20];
char sex;
float score;
}s1={102,"XinHao_ Li",'M',78.5},*pstu;
int main(){
pstu=&s1;
printf(FORMAT,s1.num,s1.name,s1.sex,s1.score);
printf(FORMAT,(*pstu).num,(*pstu).name,(*pstu).sex,(*pstu).score);
printf(FORMAT,pstu->num,pstu->name,pstu->sex,pstu->score);
}
```
###Input example:
```in
```
###Output example:
```out
Number=102 Name=XinHao_ Li Sex=M Score=78.500000
Number=102 Name=XinHao_ Li Sex=M Score=78.500000
Number=102 Name=XinHao_ Li Sex=M Score=78.500000
```







answer:If there is no answer, please comment