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
ddd [48]
4 years ago
7

What is the difference between "call by value" and "call by reference"? Explain with example in c language.

Computers and Technology
1 answer:
Serjik [45]4 years ago
7 0

Answer:

<u>Call by reference</u>

In an function if the variables are passed as reference variables this means that the variables are pointing to the original arguments.So the changes made in the function on the reference variables will be reflected back on the original arguments.

For example:-

#include<stdio.h>

void swap(&int f,&int s)

{

   int t=f;

   f=s;

  s =temp;  

}

int main()

{

int n,m;

n=45;

m=85;

swap(n,m);

printf("%d %d",m,n);

return 0;  

}

the values of m and n will get swapped.  

<u> Call by value</u>

In this program the values of m and n will not get swapped because they are passed by value.So duplicate copies of m and n will be created and manipulation will be done on them.

#include<stdio.h>

void swapv(int f,int s)

{

   int t=f;  

   f=s;  

   s=temp;

}

int main()

{  

int n,m;

n=45;

m=85;

swapv(n,m);

printf("%d %d",n,m);

return 0;

}

You might be interested in
What are two key elements of describing the environment?​ a. ​ Communication protocols and security methods b. ​ External system
pashok25 [27]

Answer:

B. External systems and technology architecture.

Explanation:

In such environment, you have to know what external systems are in place so have proper communication with External Systems whether be in message format or web/networks, Communication protocols, Security methods, Error detection and recovery,

Additionally, it consits of technology architecture so conforming to an existing technology architecture helps us discover and describe existing architecture

3 0
3 years ago
you have just received a new hdd so you connect it to your computer. the disk manager software recognizes the disk but when you
crimeas [40]

The most likely problem is the disk is not low-level formatted. Windows' Disk Management system software gives you the ability to carry out sophisticated storage functions.

Windows' Disk Management system software gives you the ability to carry out sophisticated storage functions. Hard disk software is used on hard disk drives to complete a variety of tasks, such as file system checks and error checking, backups, defragmentation, data recovery, and partitioning.

Initializing a new drive can be used to set up a new drive.

See Expand a basic volume to extend a volume into space that isn't already occupied by a volume on the same drive.

Utility software called disk management tools is used to manage data on disk by carrying out various operations on it. Additionally, they carry out tasks like managing drives, formatting disks, checking disks, and partitioning devices.

To know more about Disk Management click here:

brainly.com/question/2742036

#SPJ4

8 0
2 years ago
Read 2 more answers
Consider the following code:
Semmy [17]

Answer:

5

Explanation:

4 0
3 years ago
#include
Ivanshal [37]

Answer:

dang sis did u really have to but all of that

3 0
4 years ago
Please verify you are a human Access to this page has been denied because we believe you are using automation tools to browse th
gizmo_the_mogwai [7]

Answer:

The answer is (a).

Explanation:

8 0
3 years ago
Read 2 more answers
Other questions:
  • In two or more complete sentences, summarize the difference between renewable and nonrenewable resources? Justify your responses
    13·2 answers
  • (A) writer or word <br> (B) Calc or Excel <br> (C) impress or PowerPoint<br> (D) none of these
    14·1 answer
  • We will pass in 2 values, X and Y. You should calculate XY XY and output only the final result. You will probably know that XY X
    13·1 answer
  • Which is a good guideline to follow for adding animation to a presentation?. A. Use a different animation for each slide.. B. Us
    8·2 answers
  • To move to the beginning of the line with the keyboard, press the _______ key(s).
    6·1 answer
  • Visual Design includes 4 elements: shapes, texture, lines and form.
    6·1 answer
  • Re:
    15·1 answer
  • This is the area that displays icons representing open applications.
    15·1 answer
  • Before creating a graphic, you should _____. Select all that apply. A. export it as an SVG file B. consider whe
    12·1 answer
  • you are pairing a bluetooth headset to a mobile device. on the device, after finding the device for pairing, what is the next st
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!