// // main.c // 指针结构体 // // Created by chenxinju on 15/12/1. // Copyright © 2015年. All rights reserved. //
#include <stdio.h>
struct xiao{
char *name;
int age ;
char *sfz; };
int main(int argc, const char * argv[]) {
struct xiao p1={"陈小白",25,"it小白"};
struct xiao p2={"李大侠",26,"it大侠"};
struct xiao per[2]={p1,p2};
struct xiao *p =per;
for (int i =0; i<2; i++) { printf("姓名:%s--年龄:%d\n",(*(per+i)).name,(*(per+i)).age);
}
return 0; }
|