CPlusPlusThings/practical_exercises/10_day_practice/day2/结构体.cpp
Light-City a4d828bb4c update
2020-04-06 00:57:02 +08:00

22 lines
366 B
C++

#include<iostream>
using namespace std;
struct student
{
int num;
char name[20];
char gender;
};
int main(int argc, char const *argv[])
{
student s={10,"asd",'M'};
cout<<s.num<<endl;
cout<<sizeof(s.num)<<endl;
cout<<sizeof(s.name)<<endl;
cout<<sizeof(s.gender)<<endl;
cout<<sizeof(s)<<endl;
system("pause");
return 0;
}