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


TheNamesImani

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

 

Did you know?

A headache when you wake up in the morning is indicative of sinusitis. Other symptoms of sinusitis can include fever, weakness, tiredness, a cough that may be more severe at night, and a runny nose or nasal congestion.

Did you know?

Methicillin-resistant Staphylococcus aureus or MRSA was discovered in 1961 in the United Kingdom. It if often referred to as a superbug. MRSA infections cause more deaths in the United States every year than AIDS.

Methicilli ...
Did you know?

Once thought to have neurofibromatosis, Joseph Merrick (also known as "the elephant man") is now, in retrospect, thought by clinical experts to have had Proteus syndrome. This endocrine disease causes continued and abnormal growth of the bones, muscles, skin, and so on and can become completely debilitating with severe deformities occurring anywhere on the body.

Did you know?

Many supplement containers do not even contain what their labels say. There are many documented reports of products containing much less, or more, that what is listed on their labels. They may also contain undisclosed prescription drugs and even contaminants.

Did you know?

Prostaglandins were first isolated from human semen in Sweden in the 1930s. They were so named because the researcher thought that they came from the prostate gland. In fact, prostaglandins exist and are synthesized in almost every cell of the body.

For a complete list of videos, visit our video library