#include #include struct lrc_time { char hour; char minute; char second; }; // 嵌套结构体,需要逐层赋值 typedef struct lrc { struct lrc_time start_time; // 开始时间 char *content; } LRC; int main() { // 定义结构体变量并初始化值 LRC line1 = {{0, 0, 2}, "天青色等烟雨,而我在等你"}; LRC line2; line2.start_time.hour = 0; line2.start_time.minute = 1; line2.start_time.second = 15; line2.content = "炊烟袅袅升起,隔江千万里"; printf("%02d:%02d:%02d %s\n", line1.start_time.hour, line1.start_time.minute, line1.start_time.second, line1.content); printf("%02d:%02d:%02d %s\n", line2.start_time.hour, line2.start_time.minute, line2.start_time.second, line2.content); return 0; }