1、
#include <stdio.h> #define NAME_LEN 64 struct student{ //结构体声明 char name[NAME_LEN]; int height; float weight; long schols; }; int main(void) { struct student takao = {"Takao", 173, 87.3}; //结构体成员初始化 printf("takao.name = %s ", takao.name); //对象(结构体)takao各成员的值 printf("takao.height = %d ", takao.height); printf("takao.weight = %.1f ", takao.weight); printf("takao.schols = %ld ", takao.schols); puts(" ======================"); printf("address of takao.name: %p ", &takao.name); //结构体各成员的地址 printf("address of takao.height: %p ", &takao.height); printf("address of takao.weight: %p ", &takao.weight); printf("address of takao.schols: %p ", &takao.schols); return 0; }