fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3. struct employee
  4. {
  5. char name[20];
  6. int eno;
  7. float sal;
  8. };
  9. int main()
  10. {
  11. struct employee e1 = {"RAM",51,3600.0f};
  12. struct employee e2;
  13. strcpy(e2.name,"TOM");
  14. e2.eno = 52;
  15. e2.sal = 3500.00f;
  16. printf("-------***Employee-1 details***------");
  17. printf("\nEmployee Name: %s",e1.name);
  18. printf("\nEmployee no: %d",e1.eno);
  19. printf("\nSalary: %f",e1.sal);
  20. printf("-------***Employee-2 details***------");
  21. printf("\nEmployee Name: %s",e2.name);
  22. printf("\nEmployee no: %d",e2.eno);
  23. printf("\nSalary: %f",e2.sal);
  24. return 0;
  25. }
Success #stdin #stdout 0s 5284KB
stdin
45
stdout
-------***Employee-1 details***------
Employee Name: RAM
Employee no: 51
Salary: 3600.000000-------***Employee-2 details***------
Employee Name: TOM
Employee no: 52
Salary: 3500.000000