This repository has been archived on 2025-12-15. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
2024-09-20 14:17:13 +03:00

27 lines
493 B
C

#include <stdio.h>
void increment1(int var)
{
/* call by value
* the change in var is not affecting */
var = var+1;
return;
}
void increment2(int *var)
{
/* call by reference
* The change affects "everywhere"
*/
*var = *var+1;
return;
}
int main()
{
int num=20;
increment1(num);
printf("After \'increment1\' value of num is: %d \n", num);
increment2(&num);
printf("After \'increment2\' value of num is: %d \n", num);
return 0;
}