
Read it right next to your computer.
Book version bitter C
#include <stdio.h>
#include <string.h>
typedef struct
{
char name[256];
int age;
int sex;
} People;
void InputPeople(People *data);
void ShowPeople(People data);
int main(void)
{
People data[3];
int i;
for (i = 0; i < 3; i++)
{
InputPeople(&data[i]);
}
for (i = 0; i < 3; i++)
{
ShowPeople(data[i]);
}
return 0;
}
void InputPeople(People *data)
{
printf("名前:");
scanf("%s", data->name);
printf("year齢:");
scanf("%d", &data->age);
printf("性別(1-男性、2-女性):");
scanf("%d", &data->sex);
printf("\n");
}
void ShowPeople(People data)
{
char sex[16];
printf("名前:%s\n", data.name);
printf("year齢:%d\n", data.age);
if (data.sex == 1)
{
strcpy(sex, "男性");
}
else
{
strcpy(sex, "女性");
}
printf("性別:%s\n", sex);
printf("\n");
}
Learning C language through suffering (Kushi C) is
This is the definitive introduction to the C language.
It systematically explains the basic functions of the C language.
The quality is equal to or higher than commercially available books.