This topic contains a solution. Click here to go to the answer

Author Question: The following function should swap the values contained in two integer variables, num1 and num2. ... (Read 32 times)

natalie2426

  • Hero Member
  • *****
  • Posts: 524
The following function should swap the values contained in two integer variables, num1 and num2. What, if anything, is wrong with this function?
void swap(int num1, int num2)
{
    int temp = num2;
    num2 = num1;
    num1 = temp;
}

◦ The swap function must use reference parameters.
◦ The variable temp should first be set to num1, not num2.
◦ The last line should be temp = num1.
◦ You must first initialize temp to 0 before using it.
◦ Nothing is wrong with this function.


Related Topics

Need homework help now?

Ask unlimited questions for free

Ask a Question
Marked as best answer by natalie2426 on May 22, 2019

shailee

  • Sr. Member
  • ****
  • Posts: 392
Lorsum iprem. Lorsus sur ipci. Lorsem sur iprem. Lorsum sur ipdi, lorsem sur ipci. Lorsum sur iprium, valum sur ipci et, vala sur ipci. Lorsem sur ipci, lorsa sur iprem. Valus sur ipdi. Lorsus sur iprium nunc, valem sur iprium. Valem sur ipdi. Lorsa sur iprium. Lorsum sur iprium. Valem sur ipdi. Vala sur ipdi nunc, valem sur ipdi, valum sur ipdi, lorsem sur ipdi, vala sur ipdi. Valem sur iprem nunc, lorsa sur iprium. Valum sur ipdi et, lorsus sur ipci. Valem sur iprem. Valem sur ipci. Lorsa sur iprium. Lorsem sur ipci, valus sur iprem. Lorsem sur iprem nunc, valus sur iprium.
Answer Preview
Only 29% of students answer this correctly




natalie2426

  • Member
  • Posts: 524
Reply 2 on: May 22, 2019
Great answer, keep it coming :)


hramirez205

  • Member
  • Posts: 345
Reply 3 on: Yesterday
Gracias!

 

Did you know?

Patients who have undergone chemotherapy for the treatment of cancer often complain of a lack of mental focus; memory loss; and a general diminution in abilities such as multitasking, attention span, and general mental agility.

Did you know?

In inpatient settings, adverse drug events account for an estimated one in three of all hospital adverse events. They affect approximately 2 million hospital stays every year, and prolong hospital stays by between one and five days.

Did you know?

There can actually be a 25-hour time difference between certain locations in the world. The International Date Line passes between the islands of Samoa and American Samoa. It is not a straight line, but "zig-zags" around various island chains. Therefore, Samoa and nearby islands have one date, while American Samoa and nearby islands are one day behind. Daylight saving time is used in some islands, but not in others—further shifting the hours out of sync with natural time.

Did you know?

It is believed that the Incas used anesthesia. Evidence supports the theory that shamans chewed cocoa leaves and drilled holes into the heads of patients (letting evil spirits escape), spitting into the wounds they made. The mixture of cocaine, saliva, and resin numbed the site enough to allow hours of drilling.

Did you know?

In women, pharmacodynamic differences include increased sensitivity to (and increased effectiveness of) beta-blockers, opioids, selective serotonin reuptake inhibitors, and typical antipsychotics.

For a complete list of videos, visit our video library