结构体应用三
#include <stdio.h> #include <stdlib.h> #include <string.h> static struct s1 { char c[4]; char* s; }s1 = {"abc","def"}; static struct s2 { char* cp; struct s1 ss1; }s2 = {"ghi","jkl","mno"}; int main() { printf("%c,%c\n",s1.c[0],*s1.s); printf("%s,%s\n",s1.c,s1.s); printf("%s,%s\n",s2.cp,s2.ss1.s); printf("%s,%s\n",++s2.cp,++s2.ss1.s); return 0; }
一勤天下无难事。