C program to demonstrate call by reference, C/C++ Programming

C program to demonstrate call by reference:

void disp(int *,int*,int*,int*);

void main()

{

                int a=2,b=3, sum,mul;

                printf("Enter 1st no:\n");

                scanf("%d",&a);

                printf("Enter 2nd no:\n");

                scanf("%d",&b);

                disp(&a,&b,&sum,&mul);

                printf("\nsum=%d",sum);

                printf("\nMultiplication=%d",mul);

                getch();

}

void disp(int *x,int*y,int *s,int *m)

{

                *s=*x+*y;

                *m=(*x)*(*y);

}

Output:

772_call by reference.png

Posted Date: 9/29/2012 6:56:49 AM | Location : United States







Related Discussions:- C program to demonstrate call by reference, Assignment Help, Ask Question on C program to demonstrate call by reference, Get Answer, Expert's Help, C program to demonstrate call by reference Discussions

Write discussion on C program to demonstrate call by reference
Your posts are moderated
Related Questions
I have a very confusing assignment and I''m struggling to find the right place to begin or how to break the problem down.

who to write max if statements in a program

void main() { int *p, *q, i ; p=(int*)100; q=(int*)200; i=q-p; printf("%d",i); } }

assume that the first integer read with cin specifies the number of values remaining to be entered. that program should read only one value each time cin is executed .a typical inp

Add words in Dictionary: void Dictionary::add( Object& objectToAdd ) {     if( !objectToAdd.isAssociation() )         ClassLib_error( __ENOTASSOC );     else


Question 1 Create a class String which stores a string value. Overload ++ operator which converts the characters of the string to uppercase (toupper() library function of "ctype.h

Goals For this assignment you will write programs in C and LC-3 assembly code. Both programs will perform the identical recursive algorithm. The goals of this programming assignmen

(a) Pairs may be represented using a lambda. Using only lambdas, create a procedure (triple x y z) that constructs a triplet. You may NOT use car, cons or cdr in the triplet proced

Can you think of a condition where your program would crash without attaining the breakball, which you set at the straining of main()? A: C++ let for dynamic initialization of g