int main() { struct score { char name[10]; int stu_score; }; score stu1 = { "hu",96}; score *p_stu1; p_stu1 = &stu1; score stu2[] = { { "ming",88},{"long",87 },{"lang",90} }; score *p_stu2; p_stu2 = &stu2[0]; int *p_int1; int int_a1 = 100; p_int1 = &(int_a1); // 用普通结构体的方法获取值 printf("name:%s,stu_score:%d ",stu1.name,stu1.stu_score); //用指针获取结构体中的值 printf("pointer: "); printf("name:%s,stu_score:%d ",(*p_stu1).name,(*p_stu1).stu_score); printf("#################################"); //printf(stu1.name, stu1.stu_score); //printf((*p_stu1).name, (*p_stu1).stu_score); printf("name:%s,stu_score:%d ", stu2[0].name, stu2[0].stu_score); printf("name:%s,stu_score:%d ", stu2[1].name, stu2[1].stu_score); printf("name:%s,stu_score:%d ", stu2[2].name, stu2[2].stu_score); printf("pointer: "); printf("name:%s,stu_score:%d ", (*p_stu2).name,(*p_stu2).stu_score); printf("name:%s,stu_score:%d ", (*(p_stu2 + 1)).name, (*(p_stu2 + 1)).stu_score); printf("name:%s,stu_score:%d ", (*(p_stu2 + 2)).name, (*(p_stu2 + 2)).stu_score); printf("address p_int1:%d,value:%d ", p_int1, *p_int1); system("pause"); return 0; }