#include<stdio.h>
#include<string.h>
struct Student{
char name[100];
int age;
int score;
};
int main(){
struct Student s = {"Garrix", 27, 100};
struct Student *p = &s;
//结构体指针访问结构体属性,用"->"
printf("姓名: %s 年龄: %d 分数: %d\n",p->name, p->age, p->score);
}
C语言结构体指针
最新推荐文章于 2024-10-02 23:41:45 发布