c program to swap two numbers using call by reference

#include <stdio.h>
 
void swap(int*, int*);
 
int main()
{
   int x, y;
 
   printf("Enter the value of x and y\n");
   scanf("%d%d",&x,&y);
 
   printf("Before Swapping\nx = %d\ny = %d\n", x, y);
 
   swap(&x, &y); 
 
   printf("After Swapping\nx = %d\ny = %d\n", x, y);
 
   return 0;
}
 
void swap(int *a, int *b)
{
   int temp;
 
   temp = *b;
   *b = *a;
   *a = temp;   
}
 

Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
Write a program in C to swap two numbers using functions (Use call by reference) c program to swap two numbers without a third variable using conditionals c program to swap two numbers without a third variable swap 2 numbers using call by reference in c write a program in c to swap two numbers Write a c program to swap two numbers without using third variable. swap two numbers in c using function Write a function in C to SWAP the values of TWO variables using call-by- reference. swap using 2 variables c write a c program to swap two numbers using third variable c program to swap two numbers using pass by references swapping two numbers in c using mathematical expression swapping of two numbers in c by call by reference in c code for swaping two numbers in c using pointers how to swap two numbers in c using function write a program to swap two numbers in c swap two numbers in c using call by value swap two numbers using predefined variable c program program to swap two numbers in c swap using two variables in c swap two numbers in c Write a program to swap two variables using pass by reference function in c c program to swap two numbers using call by value Write a C Program to swap two given numbers using call by reference. C ode to swap 2 numbers program to swap two numbers without using third variable in c how to swap two numbers in c without using third variable c program to swap two numbers using function call by value swap two numbers using function in c swap 2 numbers using functions in c c program to swap two numbers using functions how to swap two numbers in c swap of two numbers in c write a function to swap two integers in c swapping of two numbers in c without third variable swap tow number in c write c program to swap two numbers Write down a program in C for swapping of two numbers using bitwise operators Write down a program in C for swapping of two numbers using * and / operator Write down a program in C for swapping of two numbers using + / - operator swap two numbers in c without using third variable write a c program to swap two numbers without using third variable c swap two variables function swap two numbers without using third variable in c swap two numbers using third variable in c swap 2 numbers c efficient C Program to Swap Two Numbers using and without using third variable C program to swap two numbers without using third variable. write a c program to swap two numbers Write a program to swap 2 numbers -Without third variable. in c Write a program to swap 2 numbers -Without thirdvariable. in c Write a program to swap 2 numbers -Without 3rd variable. in c C Program to swap two numbers explained C Program to swap two numbers without third variable c program for swapping of two numbers using temporary variable swap 2 numbers in c swap of 2 numbers in c swapping of two numbers without using third variable in c Write a C program to swap two number using call by reference write a c program to swap two numbers without using temporary variable and by passing by reference write a c program to swap two numbers without using temporary variable c program to swap two numbers using pointers call by value and call by reference in c swapping two numbers using Write a C program to swap two numbers entered by user. Program to swap values of two variables using call by reference method. in c c program to swap two numbers without using third variable c program to swap two numbers using third variable swapping of two numbers in c program for swapping of two numbers in c Write a c program to swap two numbers. swapping two numbers in C programs c program to swap two numbers c program to swap two numbers using call by reference
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source