【C】typedef struct的用法

typedef struct 的用法

#include<stdio.h>
typedef struct student{
    
    
	int age;
	char gender;
}stu1;

int main(){
    
    
	stu1 stu;
	stu.age=11;
	printf("%d",stu.age);
	
}

没有 typedef

#include<stdio.h>
struct student{
    
    
	int age;
	char gender;
}stu1;

int main(){
    
    
	struct student stu1;
	stu1.age=11;
	printf("%d",stu1.age);
	
}

猜你喜欢

转载自blog.csdn.net/qq_36045898/article/details/108438620