1.结构体指针的基本形式

struct 结构体名 *指针名;

2.结构体使用方法利用->可以通过结构体指针访问

struct student stu

struct student *p = &stu

p->num = 1000;

strcpy(p- name,"lishi")

p->sctor = 90;

3.代码实现

#include

#include

struct stu

{

char name[16];

int age;

float score;

};

int main()

{

struct stu s;

struct stu *p;

p = &s;

strcpy( p -> name, "lihua" );

p ->age = 5;

p ->score = 90;

printf("%s %d %f",p -> name ,p -> age, p -> score);

return 0;

}

4.运行结果