#include<stdio. h>
void swap(int &, int &);
void main(){
int num1, num2;
printf("Enter 2 numbers > ");
scanf("%d%d", &num1, &num2);
if(num1 > num2)
swap(&num1, &num2);
printf("In ascending order: %d %d \n", num1, *num2);
}
void swap(int *a, int b)
{
int hold;
hold = a;
*a = b;
b = hold;
}
*Function swap() will swap the contents of two variables passed by
reference to it.
*Identify error(s) that occur in the program
gud luck
void swap(int &, int &);
void main(){
int num1, num2;
printf("Enter 2 numbers > ");
scanf("%d%d", &num1, &num2);
if(num1 > num2)
swap(&num1, &num2);
printf("In ascending order: %d %d \n", num1, *num2);
}
void swap(int *a, int b)
{
int hold;
hold = a;
*a = b;
b = hold;
}
*Function swap() will swap the contents of two variables passed by
reference to it.
*Identify error(s) that occur in the program
gud luck
Comment