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
In the ____________________ approach, the project is initiated by upper-level managers who issue policy, procedures and processe
FrozenT [24]

Answer:

top-Down

Explanation:

4 0
3 years ago
The IBM nine-track tapes that became the industry standard for storage for three decades had several sizes , the most common bei
sergey [27]

Answer:

5 MB.

Explanation:

1 foot = 12 inches

2400/9=266.66 feet per track

1 track excluding, remaining 8 track =2400 - 266.66 = 2133.33 feet

so, space available to store data = 2133.33 feet

now, 2133.33 feet = 25600 inches

total data that can be stored = 25600 * 1600 = 40960000 bits

= 46080000/8 = 5120000 Bytes

= 5120000/1000000 = 5.12 MB = 5 MB (approx.)

3 0
3 years ago
What is a cpu in full explanation?
diamong [38]

Explanation:

The computer's central processing unit (CPU) is the portion of a computer that retrieves and executes instructions. The CPU is essentially the brain of a CAD system. It consists of an arithmetic and logic unit (ALU), a control unit, and various registers. The CPU is often simply referred to as the processor.

8 0
3 years ago
Read 2 more answers
write a function that takes a string as parameter, return true if it’s a valid variable name, false otherwise. You can use keywo
never [62]

Answer:

The solution code is written in Python 3:

  1. import keyword  
  2. def checkValidVariable(string):
  3.    if(not keyword.iskeyword(string)):
  4.        return True  
  5.    else:
  6.        return False  
  7. print(checkValidVariable("ABC"))
  8. print(checkValidVariable("assert"))

Explanation:

Firstly, we need to import keyword module so that we can use its iskeyword method to check if a string is registered as Python keyword (Line 1).

Next, we create a function checkValidVariable that takes one input string (Line 3). Within the function body, we use iskeyword method to check if the input string is keyword. Please note the "not" operator is used here. So, if iskeyword return True, the True value will be turned to False by the "not" operator or vice versa (Line 4-5).

We test the function by passing two input string (Line 9-10) and we shall get the sample output as follows:

True

False

8 0
3 years ago
If Johanna wants to label the x- and y-axes in Excel she should click Layout, then what?
denis-greek [22]
<span> If Johanna wants to label the x and y axes in an Excel chart, she should click anywhere on the chart, then click on the Layout tab. Under Labels, she should click on Axis Titles, and select the Secondary Horizontal Axis Title for x axis or <span>Secondary Vertical Axis Title for y axis. She should then select the text that is in the Axis Title box, and type the title name that she wants.</span></span>


6 0
3 years ago
Other questions:
  • Demonstrate your grasp of the Unix file system by constructing a directory structure as follows: In your home ( ~ ) directory, c
    11·1 answer
  • What is the operating system?
    9·1 answer
  • Given the integer variables x and y, write a fragment of code that assigns the larger of x and y to another integer variable max
    5·1 answer
  • Susan bought a new sweater on sale for $28.93.she was charged HST of 13%.find the total amount of her bill including taxes.​
    9·1 answer
  • 4. Extrusion tools in Blender® duplicate vertices while keeping the geometry connected with the original vertices. (1 point)
    7·1 answer
  • You receive $50 as a birthday gift and choose to spend it all on new wallpaper for your room. The opportunity cost of this decis
    7·1 answer
  • 5. The hazardous component in most antifreeze is _____, which is extremely toxic to humans and animals. A) Calcium Carbonate B)
    13·2 answers
  • harry is analyzing inbound network traffic and notices a tcp packet that has the FIN,PSH, and URG flags set at the same time. wh
    8·1 answer
  • Why is it important for software developers to study Human-Computer Interaction? to make sure a user interface is easy to use, w
    10·2 answers
  • Pls paanswer asap......​
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!