1 2 3 4 5 6 7 8 9 10 11 12 | #include <stdio.h> char name[4][10] = { "È«±æµ¿", "À̼ø½Å", "°°¨Âù", "À¯°ü¼ø" }; char tmp[10]; int main(void) { // tmp = name[2]; ¹®¹ý ¿À·ù strcpy(tmp,name[2]); printf("%s\n", tmp); } | cs |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #include <stdio.h> struct student_info { char name[10]; int age; float weight; }; struct student_info students[4] = { {"È«±æµ¿", 504, 67.5}, {"À̼ø½Å", 703, 80.3}, {"°°¨Âù", 645, 77.0}, {"À¯°ü¼ø", 205, 56.5} }; int main(void) { struct student_info tmp; tmp = students[2]; printf("%s %d %f\n", tmp.name, tmp.age, tmp.weight); } | cs |