Need help answering these questions Here is the assignment h

Need help answering these questions: Here is the assignment. http://docdro.id/nPtvMAc You need to make your own struct.

Solution

A structure is simply an user defined datatype.

properties of structure:

1.The elements are of different datatype.

2.The order of elements are not like indexing as of arrays i.e.,they are arbitary.

Defining a struture: In order to define a strucure we need to define the keyword \"struct\"

The basic format of a structure definition is:

eg:

struct Books {

char title[50];

char author[50];

char subject[100];

int book_id;

} book;

1.Define Payroll structure, define variables of structure type, initialize values and then print out values of different elements (structure members).

in order to define the payroll structure of an employee we can think the basic elements as follows.

print out values of different elements:

void func(struct emp*record);  

return 0;

2. Pass the structure as a function argument (using pointer), and print element again.

The emp structure is passed to another function by address. It means the address of the structure is passed to another function.

void func(struct emp*record)

{

          printf(\" Id is: %d \ \", record->empno);

          printf(\" Name is: %s \ \", record->name);

          printf(\" Percentage is: %f \ \", record->npay);

}

Need help answering these questions: Here is the assignment. http://docdro.id/nPtvMAc You need to make your own struct.SolutionA structure is simply an user def

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site