My issue
my coad is right but it’s tell wrong answer.
My code
#include <stdio.h>
void swapByValue(int x, int y)
{
int temp = x;
x = y;
y = temp;
printf("Using call-by-value x=%d,y=%d\n", x, y);
}
void swapByReference(int *x, int *y)
{
int temp = *x;
*x = *y;
*y = temp;
printf("Using call-by-reference x=%d,y=%d\n", *x, *y);
}
int main()
{
int a, b;
scanf("%d %d", &a, &b);
printf("Using call-by-value x=%d,y=%d\n", a, b);
swapByReference(&a, &b);
return 0;
}
Learning course: Learn C Programming
Problem Link: https://www.codechef.com/learn/course/rcpit-programming-c/RCPITLPC37/problems/LJAJAG38