Consider the following structure declaration struct Item int

Consider the following structure declaration: struct Item {int invenNum; double cost; int quantity;}; Item tool; Which function prototype can be used for a function that displays tool\'s cost? void display(Item tool); void display(double tool, cost); either a or b. neither a nor b The function whose prototype is Item getData(); returns___ The address of a structure a copy of a structure a pointer to a structure nothing The function whose prototype is void getData(Item & thing); receives___ a pointer to a structure a reference to a structure a copy of a structure nothing The function whose prototype is void getData(Item * thing); receives a pointer to a structure a reference to a structure a copy of a structure

Solution

1)
ans. B
   your option is correct.why because you can display the cost of tool by using option A also but displaying only cost option B is coorect.
2)
ans. B
   it is general return type by value not address. if function prototype is like Item* getData() then it returns the address of the value(structure)
3)
ans. B
   it uses the reference operator\'&\'. to get the reference of structure instead of value.
4)
ans. A
   it uses the pointer operator for parameter passing(declaration).

 Consider the following structure declaration: struct Item {int invenNum; double cost; int quantity;}; Item tool; Which function prototype can be used for a fun

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site