#include <stdio.h>
#define NUM 3
struct mem
{
char name[20];
char photo[10];
};
main()
{
struct mem man[NUM];
int i;
for (i = 0; i < NUM; i++)
{
printf("input name:\n");
gets(man[i].name);
printf("input photo:\n");
gets(man[i].photo);
}
printf("name\t\t\tphoto\n\n");
for (i = 0; i < NUM; i++)
{
printf("%s\t\t\t%s\n", man[i].name, man[i].photo);
}
}
提示:
/tmp/ccLUIAhc.o: In function `main':
t11-4.c:(.text+0x38): warning: the `gets' function is dangerous and should not be used.