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 37 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


cassie_ragen

  • Member
  • Posts: 347
Reply 3 on: Yesterday
Excellent

 

Did you know?

People about to have surgery must tell their health care providers about all supplements they take.

Did you know?

There are actually 60 minerals, 16 vitamins, 12 essential amino acids, and three essential fatty acids that your body needs every day.

Did you know?

People with alcoholism are at a much greater risk of malnutrition than are other people and usually exhibit low levels of most vitamins (especially folic acid). This is because alcohol often takes the place of 50% of their daily intake of calories, with little nutritional value contained in it.

Did you know?

As many as 28% of hospitalized patients requiring mechanical ventilators to help them breathe (for more than 48 hours) will develop ventilator-associated pneumonia. Current therapy involves intravenous antibiotics, but new antibiotics that can be inhaled (and more directly treat the infection) are being developed.

Did you know?

Most childhood vaccines are 90–99% effective in preventing disease. Side effects are rarely serious.

For a complete list of videos, visit our video library