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 34 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
Gracias!


jojobee318

  • Member
  • Posts: 298
Reply 3 on: Yesterday
:D TYSM

 

Did you know?

Urine turns bright yellow if larger than normal amounts of certain substances are consumed; one of these substances is asparagus.

Did you know?

Despite claims by manufacturers, the supplement known as Ginkgo biloba was shown in a study of more than 3,000 participants to be ineffective in reducing development of dementia and Alzheimer’s disease in older people.

Did you know?

Not getting enough sleep can greatly weaken the immune system. Lack of sleep makes you more likely to catch a cold, or more difficult to fight off an infection.

Did you know?

Most women experience menopause in their 50s. However, in 1994, an Italian woman gave birth to a baby boy when she was 61 years old.

Did you know?

The oldest recorded age was 122. Madame Jeanne Calment was born in France in 1875 and died in 1997. She was a vegetarian and loved olive oil, port wine, and chocolate.

For a complete list of videos, visit our video library