/*L*/

/*[‚bŒ¾Œê]ƒTƒ“ƒvƒ‹ƒvƒƒOƒ‰ƒ€W@“ü‚ê‘Ö‚¦ƒ\[ƒX‚R*/

/*–ÚŽŸ‚Ö–ß‚é*/

#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <string.h> struct STUDENT{ char name[128]; int age; }; struct STUDENT set_data(char *, int); void my_swap2(struct STUDENT *,struct STUDENT *); int main(){ struct STUDENT student[2]; int i; student[0] = set_data("tanaka",15); student[1] = set_data("suzuki",12); for(i=0;i<2;i++){ printf("%d:%s %d\n",i,student[i].name,student[i].age); } my_swap2(&student[0],&student[1]); printf("\n"); for(i=0;i<2;i++){ printf("%d:%s %d\n",i,student[i].name,student[i].age); } return 0; } struct STUDENT set_data(char *name, int age){ struct STUDENT tmp; strcpy(tmp.name,name); tmp.age = age; return tmp; } void my_swap2(struct STUDENT *a,struct STUDENT *b){ struct STUDENT tmp; tmp = *a; *a = *b; *b = tmp; }

/*ƒy[ƒW‚̐擪‚Ö*/

/*–ÚŽŸ‚Ö–ß‚é*/

/*HOME*/

/*Copyright 2016 K.N/petitetech.com*/

/*L*/