Program in C to add numbers using call by reference
This program in C will accept 2 numbers and perform addition of two numbers using call by reference method. The below program accepts 2 numbers from the user and stores the value in num1 and num2. The program then makes a call to add function. We are passing address/reference of num1 and num2 as function parameters and hence the name, call by reference (also known as – pass by reference) #include <stdio.h> #include <stdlib.h> int main(){ int num1, num2, result; /*Accept the numbers from the user*/ printf(“\nEnter the two number: “); scanf(“%d %d”, &num1, &num2); /* Pass the value of...
