In this program, You will learn how to add two numbers using call by reference in c
Call by Reference
void sum(int a, int b, int *s){
//statement
}
#include<stdio.h>
void sum(int a, int b, int *s) {
*s = a + b;
}
int main() {
int a, b, s;
printf("Enter two numbers:");
scanf("%d%d", &a, &b);
sum(a, b, &s);
printf("Sum is:%d", s);
return 0;
}
Enter two numbers:10 20
Sum is:30