Write a program swap two number using call by reference/call by value?
Answers
Answered by
4
Answer:
- Call by reference Example: Swapping the values of the two variables
- #include <stdio.h>
- void swap(int *, int *); //prototype of the function.
- int main()
- {
- int a = 10;
- int b = 20;
- printf("Before swapping the values in main a = %d, b = %d\n",a,b); // printing the value of a and b in main.
- swap(&a,&b);
Similar questions