1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Maurinko [17]
3 years ago
7

Taking a suitable example in c language explain the of call by value and call by reference concepts.

Computers and Technology
1 answer:
Degger [83]3 years ago
8 0

Answer: The difference between call by value and call by reference is that in call by value the actual parameters are passed into the function as arguments whereas in call by reference the address of the variables are sent as parameters.

Explanation:

Some examples are:

call by value

#include <stdio.h>  

void swap(int, int);

int main()

{  int a = 10, b= 20;

 swap(a, b);

 printf("a: %d, b: %d\n", a, b);

}  

void swap(int c, int d)

{

 int t;

 t = c; c = d; d = t;

}  

OUTPUT

a: 10, b: 20

The value of a and b remain unchanged as the values are local

//call by reference

#include <stdio.h>

 void swap(int*, int*);

 int main()

{

 int a = 10, b = 20;

 swap(&a, &b);   //passing the address

 printf("a: %d, b: %d\n", a, b);

}

void swap(int *c, int *d)

{

 int t;

 t = *c; *c = *d; *d = t;

}

OUTPUT

a: 20, b: 10

due to dereferencing by the pointer the value  can be changed which is call by reference

You might be interested in
You are troubleshooting an issue where a PC can reach some hosts on the Internet (using either DNS name or IP address), while se
wolverine [178]

The options are missing from the question,below are the options to choose from;

A) incorrect (or missing) routes in a routers routing table

B) incorrect DNS configuration on the PC

C) incorrect default gateway configuration on the PC

D) duplicate IP addresses on your LAN

Answer: The correct answer to the question is option A

INCORRECT (OR MISSING) ROUTES IN A ROUTERS ROUTING TABLE.

Explanation: When it is possible for a PC to ping some devices but not actually all,we can then make an assumption that either it has a wrong subnet that is configured or the router from the path to the remote device actually has an incorrect or a missing routes to the device.

5 0
3 years ago
Where does the book icon of the Help file take you?
8_murik_8 [283]

Where does the book icon of the Help file take you?

ans To a section to browse Help by category.

is answer hope you like it

"c"is correct

5 0
2 years ago
Mel is skilled in identifying the technical, economic, and organizational feasibility of software. In which phase of SDLC should
kirill115 [55]

SDLC refers to Software/System Development Life Cycle, which is defined as <em>a process involving various stages to ensure high-quality end product.</em>

It generally contains six phases: planning, analysis, design, implementation, testing, deployment, and maintenance.

A person with Mel’s level of capability should be dealing with the (A) analysis level of SDLC.

5 0
3 years ago
You can italicize a word by selecting it and clicking the italics icon. what keyboard shortcut could you use instead of clicking
Zina [86]
D. Control I for Microsoft word
3 0
2 years ago
Create a console application, no user defined class is necessary for this program, all code is to be implemented in Main.
zheka24 [161]

Answer:

The code is designed using C++ with comments

Explanation:

#include<bits/stdc++.h>

using namespace std;

int main(){

int pay, hours; //declaring hourly pay rate and number of hours worked

cout<<"Enter hourly pay rate: "<<endl; //taking user input

cin>>pay;

cout<<"Enter hours worked: "<<endl; //taking user input

cin>>hours;

int gross;

if (hours<=40){

gross=hours*pay; //calculating gross pay

}

else if (hours>40){

gross=40*pay+(hours-40)*1.5*pay; //calculating gross pay for overtime

}

int withholding, netpay;

//calculation of withholding..

if (gross>1000){

withholding=(gross*28)/100;

}

else if (gross>600 && gross<=1000){

withholding=(gross*21)/100;

}

else if (gross<=600){

withholding=(gross*10)/100;

}

netpay=gross-withholding; //calculation of netpay

cout<<"Gross pay is $"<<gross<<endl; //output

cout<<"Net pay is $"<<netpay<<endl; //output

return 0;

}

8 0
2 years ago
Other questions:
  • The illustrations group contains all but a _______​
    9·1 answer
  • In the windows firewall, any rules preceded by a __________ checkmark have not been enabled. black gray green red
    13·1 answer
  • The following function takes an array of n integers as its input and returns 1 if the array is sorted in non-decreasing order, 0
    15·1 answer
  • Which is a form of cyber bullying??
    9·1 answer
  • PLEASE HELP! I'm offering brainliest!
    6·1 answer
  • 1. If an F# function has type 'a -&gt; 'b when 'a : comparison, which of the following is not a legal type for it? Select one:
    14·1 answer
  • They are correct? thank you!
    6·2 answers
  • domain controllers store local user accounts within a sam database and domain user accounts within active directory. true or fal
    10·1 answer
  • Describe the steps to change an existing macro in Microsoft office 2016
    6·1 answer
  • write a function named get majority last name that accepts as its parameter a dictionary from strings to strings the keys of the
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!