Question: Create a C program with the following capability. Define a structure named as Employee with the following items: First name may be up to 20

Create a C program with the following capability.

  1. Define a structure named as Employee with the following items:
    1. First name may be up to 20 chars. Use array of chars.
    2. Last name may be up to 20 chars. Use array of chars.
    3. Salary double variable.
  2. Create an array of Employee structure for storing data for up to 100 employees. Name the array as EmployeeArr1.
  3. Find out the size (in terms of number of bytes) of Employee structure and print it.
  4. Find out the size (in terms of number of bytes) of EmployeeArr1 array and print it.
  5. Dynamically create by using malloc() an array of Employee structure for storing data for up to 200 employees. Name the array as EmployeeArr2.
  6. Find out the size (in terms of number of bytes) of EmployeeArr2 array and print it.
  7. Find out the address of EmployeeArr1[0] you have to use a format string of %p inside printf function to print an address.
  8. Find out the address of EmployeeArr1[99] and print it.
  9. Find out the address of EmployeeArr2[0] and EmployeeArr2[99] and print them.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!