Call By reference

Call by Reference


A classic example of call by reference is :

#include <stdio.h>
void add(int *num1,int *num2)
{
    *num1=5;
    *num2=10;
}
int main()
{
    int a,b;
    printf("\n Enter two numbers : ");
    scanf("%d%d",&a,&b);
    add(&a,&b);
    printf("\n %d %d ",a,b);
    return 0;
}

Comments

Popular posts from this blog

Bubble Sort ( C & Python 3)

Comparison Logical and Bitwise Operator ( Java Part - 4 )

Something about me