结构体指针

include <stdio.h>

struct stu
{
int num;
char *name;
char sex;
float score;
} boy1 = {102, "Fishc", 'M', 78.5};

void main()
{
struct stu *pstu;
pstu = &boy1;

  printf("Number = %d
Name = %s
", boy1.num, boy1.name);      
  printf("Sex = %c
Score = %f

", boy1.sex, boy1.score);      

  printf("Number = %d
Name = %s
", (*pstu).num, (*pstu).name);      
  printf("Sex = %c
Score = %f

", (*pstu).sex, (*pstu).score);      

  printf("Number = %d
Name = %s
", pstu->num, pstu->name);      
  printf("Sex = %c
Score = %f

", pstu->sex, pstu->score);      

}

原文地址:https://www.cnblogs.com/poli/p/4562031.html