#include <stdio.h>
#define SIZE 150
typedef struct emp_type {
char name[20];
int ID;
} emp_type;
void print_empt(emp_type *s)
{
printf("Name: %s\n",
s->name);
printf("ID: %d\n", s->ID);
}
emp_type *
read_emp(emp_type *s)
{ int ID;
char name[20];
printf("Enter ID and name\n");
if (scanf("%d %19s",
&ID, name) == EOF)
return NULL;
s->ID = ID;
strcpy(s->name, name);
return s;
}
int main(int argc, char *argv[])
{
emp_type employee[SIZE];
int count = 0;
int n;
while (count < SIZE)
{
if (read_emp(emp +
count) == NULL)
break;
count++;
}
for (n = 0; n < count; n++)
print_emp(employee + n);
exit(0);
}
Bookmarks