.
.
.
struct struct1{
char fam[30],name[30],otch[30],dolj[30],birthday[30],zp[30];
};
struct struct1 sotrudnik[50];
.
.
.
void vvod(void){
if (structsize==0){
printf("Введите количество сотрудников: ");
scanf("%d", &structsize);
if (structsize<1){
printf("Недопустимое значение\n");
return;
}
for (i=0;i<structsize;i++){
printf("\nСотрудник #%d\n", i+1);
printf("Введите фамилию: ");
fflush(stdin);
gets(sotrudnik[i].fam);
printf("Введите имя: ");
fflush(stdin);
gets(sotrudnik[i].name);
printf("Введите отчество: ");
fflush(stdin);
gets(sotrudnik[i].otch);
printf("Введите должность: ");
fflush(stdin);
gets(sotrudnik[i].dolj);
printf("Введите год рождения: ");
fflush(stdin);
gets(sotrudnik[i].birthday);
printf("Введите ЗП: ");
fflush(stdin);
gets(sotrudnik[i].zp);
puts("");
}
} else {
printf("Добавить сотрудника?\n1)Да\n2)Нет\n");
scanf(" %c", &choice);
switch (choice){
case '1':
printf("\nСотрудник #%d\n", structsize+1);
printf("Введите фамилию: ");
fflush(stdin);
gets(sotrudnik[structsize].fam);
printf("Введите имя: ");
fflush(stdin);
gets(sotrudnik[structsize].name);
printf("Введите отчество: ");
fflush(stdin);
gets(sotrudnik[structsize].otch);
printf("Введите должность: ");
fflush(stdin);
gets(sotrudnik[structsize].dolj);
printf("Введите год рождения: ");
fflush(stdin);
gets(sotrudnik[i].birthday);
printf("Введите ЗП: ");
fflush(stdin);
gets(sotrudnik[i].zp);
structsize++;
break;
case '2':
return;
default:
printf("Неверное значение\n");
break;
}
}
return;
}
Это функция ввода массива сотрудников. Подскажите, как потом очистить
memset(sotrudnik, 0, sizeof(sotrudnik));
обнулит всю память, занимаемую массивом