swap function c 2b 2b using pointer

Solutions on MaxInterview for swap function c 2b 2b using pointer by the best coders in the world

showing results for - "swap function c 2b 2b using pointer"
Diego Alejandro
30 Oct 2017
1#include <stdio.h>
2void SwapValue(int &a, int &b) {
3   int t = a;
4   a = b;
5   b = t;
6}
7int main() {
8   int a, b;
9   printf("Enter value of a : ");
10   scanf("%d", &a);
11   printf("\nEnter value of b : ");
12   scanf("%d", &b);
13   SwapValue(a, b);
14   printf("\nAfter swapping, the values are: a = %d, b = %d", a, b);
15   return 0;
16}