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 want Skype Recorder Application + Setup + Sourcecode + NICE UI Project Description: i want an application built which will allow user to record skype audio or video calls


b) The static keyword let a variable to maintain its value among distinct function calls. If the value of a static variable alters while the variable has been accessed, variable

Define Automatic storage classes - computer programming? The Variables declared within function bodies are automatic by default and automatic variables are declared inside a fu

program to write superposition of waves using class and objects

Objective:  Construct a C program that controls the LCD display, and is capable of displaying strings.  Add functions to the C program that allows more control over the display.

Question : (a) (i) What is a structure member in C? What is the relationship between a structure member and the structure? (ii) How can structure variables be declared in C?

Write a function that has int parameter n, makes another type of mask having n bit 1's from the left most bit and 32- n bit 0's next. The mask is called netmask in this seminar, an

write a class player that contain attributes for the player,s name,average and team

Project Description: We are seeking someone to search mp3 link form audio or m3u8 for videos. Skills required are .NET, C Programming, Engineering, C# Programming