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

Assignment Help:

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


Related Discussions:- C program to demonstrate call by reference

Create a stack using arrays, Problem : (a) Stacks can be implemented u...

Problem : (a) Stacks can be implemented using arrays. Write down the following C or C++ function to (i) create a stack (ii) add an element to a stack (push). (b) Expl

Program is to perform string operations, Program is to perform string opera...

Program is to perform string operations: Program is to perform string operation without using in built functions using classes and object void mainmenu()    {    clrs

Advantages to the use of functions, Question: (a) What is a function? A...

Question: (a) What is a function? Are functions needed when writing a C program? (b) State one of the advantages to the use of functions. (c) What do you meant by underst

Inside and outside type casting, depth description of the inside and outsid...

depth description of the inside and outside typecasting

C program for the no are in ascending order , #include stdio.h> #include...

#include stdio.h> #include conio.h> #include string.h> void main() {           int i=0,j=0,k=0,l=0;           int a[3][3],temp[3][3];           clrscr();

Control structures in cpp, Control structures The control structures app...

Control structures The control structures appear in both structured programming languages as well as object oriented programming languages.  The three constructs used are: i)

Destruction of array object, What's the order that objects in an array are ...

What's the order that objects in an array are destructed? Need assistance please explain it with example.

Simple text editor using c programming in linux environment, Deliverables: ...

Deliverables: you are required to upload your c code in the assignment dropbox set in Moodle. You are supposed to work with Linux gcc compiler and pico editor for compiling via the

C program for string operations, Aim: To implement a program for following...

Aim: To implement a program for following string operations: Length of String. String Concatenation. Substring (provide start index and length) Find character a

I need script for auto seating poker, Project Description: Not just like...

Project Description: Not just like that though. I want a similar program that can scan through poker lobbys (pokerstars, full tilt, ongame and ipoker) and seat me to the left of

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd