This C program demonstrates call by value by passing the values of two integers, a and b, into a swap function. The swap function swaps the values of the parameters a and b by using a temporary variable, but this does not affect the original values of a and b in main, since call by value was used. The original values of a and b in main are printed as 100 and 200.
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
15 views
Call by Value Program
This C program demonstrates call by value by passing the values of two integers, a and b, into a swap function. The swap function swaps the values of the parameters a and b by using a temporary variable, but this does not affect the original values of a and b in main, since call by value was used. The original values of a and b in main are printed as 100 and 200.