fork download
  1. #include <stdio.h>
  2.  
  3. #include <string.h>
  4.  
  5. #include <stdlib.h>
  6.  
  7. #include <stdlib.h>
  8.  
  9.  
  10.  
  11. struct record_em{
  12.  
  13. int id;
  14.  
  15. char name[20];
  16.  
  17. int salary;
  18.  
  19. int age;
  20.  
  21. };
  22.  
  23.  
  24.  
  25. int main()
  26.  
  27. {
  28.  
  29. struct record_em employee;
  30.  
  31. FILE *fp;
  32.  
  33. int id, salary, age;
  34.  
  35. char name[20];
  36.  
  37. int n=1;
  38.  
  39.  
  40.  
  41. fp = fopen("empRecord.dat","a");
  42.  
  43. while(n==1){
  44.  
  45. printf("\nEnter Employee ID\n");
  46.  
  47. scanf("%d",&id);
  48.  
  49. employee.id=id;
  50.  
  51. printf("\nEnter Employee Name\n");
  52.  
  53. scanf("%s",name);
  54.  
  55. employee.name=name;
  56.  
  57. printf("\nEnter Employee Salary\n");
  58.  
  59. scanf("%d",&salary);
  60.  
  61. employee.salary=salary;
  62.  
  63. printf("\nEnter Employee Age\n");
  64.  
  65. scanf("%d",&age);
  66.  
  67. employee.age=age;
  68.  
  69. fwrite(&employee,sizeof(employee),1,fp);
  70.  
  71. printf("Enter 1 to add new record \n");
  72.  
  73. scanf("%d",&n);
  74.  
  75. }
  76.  
  77.  
  78.  
  79. fclose(fp);
  80.  
  81.  
  82.  
  83. return 0;
  84.  
  85. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function ‘main’:
prog.c:55: error: incompatible types in assignment
stdout

Standard output is empty