Computer Science, asked by anamikakumari3851, 4 months ago

Write a program swap two number using call by reference/call by value?

Answers

Answered by Anonymous
4

Answer:

  1. Call by reference Example: Swapping the values of the two variables
  2. #include <stdio.h>
  3. void swap(int *, int *); //prototype of the function.
  4. int main()
  5. {
  6. int a = 10;
  7. int b = 20;
  8. printf("Before swapping the values in main a = %d, b = %d\n",a,b); // printing the value of a and b in main.
  9. swap(&a,&b);
Similar questions