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 40 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
Thanks for the timely response, appreciate it


bigcheese9

  • Member
  • Posts: 333
Reply 3 on: Yesterday
Wow, this really help

 

Did you know?

To combat osteoporosis, changes in lifestyle and diet are recommended. At-risk patients should include 1,200 to 1,500 mg of calcium daily either via dietary means or with supplements.

Did you know?

Adolescents often feel clumsy during puberty because during this time of development, their hands and feet grow faster than their arms and legs do. The body is therefore out of proportion. One out of five adolescents actually experiences growing pains during this period.

Did you know?

There are immediate benefits of chiropractic adjustments that are visible via magnetic resonance imaging (MRI). It shows that spinal manipulation therapy is effective in decreasing pain and increasing the gaps between the vertebrae, reducing pressure that leads to pain.

Did you know?

The training of an anesthesiologist typically requires four years of college, 4 years of medical school, 1 year of internship, and 3 years of residency.

Did you know?

Fewer than 10% of babies are born on their exact due dates, 50% are born within 1 week of the due date, and 90% are born within 2 weeks of the date.

For a complete list of videos, visit our video library