Advertisement
Guest User

Untitled

a guest
Apr 20th, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.66 KB | None | 0 0
  1. typedef struct database{
  2.     char fullname[50];      //Full names
  3.     int addr;       // The address
  4.     float salary;   // Salaries
  5.     int id;     // Employees' ID numbers
  6.     int noEmpl; // Number of emlployees
  7. } database;
  8.  
  9. typedef struct database *db;
  10. db construct_db(void);
  11. int main(void)
  12. {
  13.     database *employee[80];
  14.     for(int index=0;index<80;index++)
  15.     {
  16.         employee[index]=construct_db();
  17.     }
  18.     /* your code here */
  19.     return 0;
  20. }
  21. db construct_db(void)
  22. {
  23.     db ret=calloc(1,sizeof(database));
  24.     if(ret==NULL)
  25.     {
  26.         fprintf(stderr,"Error: Calloc returns NULL in construct_db.\n");
  27.         exit(EXIT_FAILURE);
  28.     }
  29.     return ret;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement