/*L*/

/*[‚bŒ¾Œê]ƒTƒ“ƒvƒ‹ƒvƒƒOƒ‰ƒ€W@Å‘å’lƒ\[ƒX‚R*/

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

#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <string.h> struct STUDENT{ char name[128]; int score; }; struct STUDENT set_data(char *, int); int my_max2(struct STUDENT *,int); int main(){ struct STUDENT student[5]; int max = 0; int i; student[0] = set_data("tanaka",385); student[1] = set_data("suzuki",212); student[2] = set_data("satou",445); student[3] = set_data("saitou",500); student[4] = set_data("watanabe",293); max = my_max2(student,sizeof(student) / sizeof(struct STUDENT)); for(i=0;i<5;i++){ printf("name:%s score:%d\n",student[i].name,student[i].score); } printf("max = %d\n",max); return 0; } struct STUDENT set_data(char *name, int score){ struct STUDENT tmp; strcpy(tmp.name,name); tmp.score = score; return tmp; } int my_max2(struct STUDENT *ary,int size){ int max = 0; int i; max = ary->score; for(i=1;i<size;i++){ if(max < (ary + i)->score){ max = (ary + i)->score; } } return max; }

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

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

/*HOME*/

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

/*L*/