Tuesday, 20 October 2020

CALL BY REFERENCE

 CALL BY REFERENCE


INPUT

#include <stdio.h>
void reference(int *aint *b)
{
    int temp;
    *a = *a + *b;
    temp = *a;
    temp = temp - *b;
    *b = temp - *b;
}
int main()
{
    int ab;
    printf("Enter the two numbers\n");
    scanf("%d\n %d\n", &a, &b);
    reference(&a, &b);
    printf("The new value of a and b are %d and %d"ab);
    return 0;
}

OUTPUT

Enter the two numbers 4 3
The new value of a and b are 7 and 1









 

No comments:

Post a Comment