C语言 定义指针数组存储3个人的结构体变量指针,并遍历

#include
#include
struct person 
{
	char name[30];
	char sex[10];
	char color[10];
	int ages;
};
void fun01()
{
    struct person s1 = {"张立","男","黄",23};
    struct person *p1 = &s1;
    struct person s2 = {"张彪","男","黄",27};
    struct person *p2 = &s2;
    struct person s3 = {"张晋若","男","黄",23};
    struct person *p3 = &s3;
    struct person *st[3] = {p1,p2,p3};
    for(int i = 0; i name,sts->sex,sts->color,sts->ages);
    }
}
int main()
{
    fun01() ;
    return 0;
}

你可能感兴趣的:(C语言,c语言)