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]
3 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]3 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
Which of the following is not a benefit of shaping data with the Power Query Editor?
algol13

Answer:

A

Explanation:

I am not 100% sure but without the shaping data, data can still be merged from multiple sources.

3 0
2 years ago
PLS HELP!!
Vera_Pavlovna [14]

Answer:

A. f/2.8

Explanation:

A hole within a lens, through which light travels into the camera body is referred to as the APERTURE.

It is typically expressed as "f number" in photography. Basically, a fast lens is any lens with a maximum aperture of f/4 or more i.e f/2.8 , f/1.8 , f/1.4 etc.

The smaller the number is the bigger the maximum aperture is. Hence, the bigger the maximum aperture the more light that your lens will allow in.

Therefore, the ideal aperture settings for a fast lens is f/2.8

7 0
2 years ago
Consider the following code segment: try : inputFile = open("lyrics.txt", "r") line = inputFile.readline() print(line) _________
aleksandrvk [35]

Answer:

The answer is "except IOError:"

Explanation:

It is part of the exception handling, that stands for input/ output operation fails, this exception aeries when we attempting to access an anti-existent file, in the program so, it will give the program related errors.

  • This type of error is handled in the try block, it also allows you to prepare the deal with the exceptional block.  
  • It also helps you to hide the bugs by using code, if you handle an unexpected error.
6 0
2 years ago
Suppose you have a 16-bit machine with a page size of 16B. Assume that any unsigned 16-bit integer can be a memory address. Also
irinina [24]

Answer:

2^11

Explanation:

Physical Memory Size = 32 KB = 32 x 2^10 B

Virtual Address space = 216 B

Page size is always equal to frame size.

Page size = 16 B. Therefore, Frame size = 16 B

If there is a restriction, the number of bits is calculated like this:  

number of page entries = 2^[log2(physical memory size) - log2(n bit machine)]

where

physical memory size = 32KB  which is the restriction

n bit machine = frame size = 16

Hence, we have page entries = 2^[log2(32*2^10) - log2(16)] = 2ˆ[15 - 4 ] = 2ˆ11

7 0
3 years ago
Ano kaya ang nararamdaman mo at mangyari sayo kung tatlong araw ka nang hindi kumakain​
Feliz [49]

Ang mararamdaman mo ay pananamlay at tila walang lakas. Ang mangyayari sayo ay magkakasakit ka at pag ipinagpatuloy mo parin ang hindi pag kain, baka hindi lang sakit aabotin mo kundi kamatayan.

3 0
2 years ago
Other questions:
  • What's the risk or effect of software piracy?
    12·2 answers
  • PLEASE HELP ITS DRIVERS ED
    8·2 answers
  • What feature new to Windows Server 2012 provides the ability to find identical sets of data on a SAN based storage array and red
    14·1 answer
  • during zach's second visit of the year, he incurred a $450 bill. Describe how much is paid by Zach and the insurance carrier
    7·1 answer
  • Suppose the price of a complement to LCD televisions falls. What effect will this have on the market equilibrium for LCD​ TVs? T
    13·1 answer
  • What does the clone tile command do?
    15·2 answers
  • You are the leader of a team at work. What type of leader would you like to be – one that gets involved and works with the team
    15·2 answers
  • In one to two sentences, describe how you would add a new slide to your presentation.
    11·2 answers
  • What is the output?
    11·1 answer
  • What is the accurate description
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!