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
Which can be used to create a poll on a web page? <br>CSS<br>HTML <br>JavaScript <br>Text editor​
NeX [460]

Answer:

HTML can be used to create a poll on a web page.

4 0
2 years ago
The incompatibilities in speed between the various devices and the CPU make I/O synchronization difficult, especially if there a
Iteru [2.4K]

Answer:

In a buffer

Explanation:

We can define a buffer as a temporary holding area for data between the various devices and the CPU make I/O synchronization especially if there are multiple devices attempting to do I/O at the same time.

Items stored at the buffer helps to reduce the The incompatibilities in speed between the various devices and the CPU.

3 0
3 years ago
any one that owns a chrome book there is a new update there is new features and there is a game on settings where you see what y
timama [110]

Answer:

THANK YOU SO MUCH! I AM ON MY CHROME BOOK RIGHT NOW AND WAS HESITATING TO DOWNLOAD THE UPDATE!

Explanation:

4 0
2 years ago
Read 2 more answers
Tracy has a file that contains a list of actors and the movies in which they acted. She wants to know the top 3 ranked actors fr
harina [27]

Answer:

{

private String name;

private String review;

/** Constructs a ProductReview object and initializes the instance variables. */

public ProductReview(String pName, String pReview)

{

name = pName;

review = pReview;

}

/** Returns the name of the product. */

public String getName()

{ return name; }

/** Returns the review of the product. */

public String getReview()

{ return review; }

}

The ReviewCollector class, shown below, is used to represent a collection of reviews to be analyzed.

public class ReviewCollector

{

private ArrayList<ProductReview> reviewList;

private ArrayList<String> productList;

/** Constructs a ReviewCollector object and initializes the instance variables. */

public ReviewCollector()

{

reviewList = new ArrayList<ProductReview>();

productList = new ArrayList<String>();

}

/** Adds a new review to the collection of reviews, as described in part (a). */

public void addReview(ProductReview prodReview)

{ /* to be implemented in part (a) */ }

/** Returns the number of good reviews for a given product name, as described in part (b). */

public int getNumGoodReviews(String prodName)

{ /* to be implemented in part (b) */ }

// There may be instance variables, constructors, and methods not shown.

}

3 0
3 years ago
Which three decisions might a specialized drone delivering medical supplies make once it's algorithm has started and it is scann
densk [106]

The decisions that a specialized drone delivering medical supplies make once it's algorithm has started and it is scanning its surround are:

  • A  tilt backyard when sensor detects an obstacle within 10 feet.
  • To disable self flying and alert pilot when sensor detects an obstacle within 3 feet.
  • To resume normal speed when sensor doesn't detect an obstacle within two feet.

<h3>How are drones used in healthcare?</h3>

Hospitals are known to have started  using drones to transport laboratory samples and also to carry out other kinds of humanitarian aids.

The use of  drones  is said to be one that is cost-effective and it is one that bring blood products, vaccines, medical supplies, and others to rural areas or areas that has small infrastructure.

A drone can find way to move around obstacles but they should not shut down where there is obstacle.

Learn more about drone from

brainly.com/question/24530012

5 0
2 years ago
Other questions:
  • Which of the following typically have the highest auto insurance premiums?
    14·1 answer
  • Correspondence involves verbal communication. True False
    6·2 answers
  • Carlos own a hardware store.He currently is not using any software to track what he has in the store. .In one to two sentences,
    10·1 answer
  • Outlines are effective because
    13·2 answers
  • A computer has been stored, uncovered, in a dusty closet for several months. Why might this situation cause the operating system
    13·1 answer
  • Lisa has a section of her document that she would like to include in the index. Which option should Lisa choose?
    5·2 answers
  • Which method is used for resolving data dependency conflict by the compiler itself?
    6·1 answer
  • How does computer number system play a Vital role in a computer calculation. ​
    8·1 answer
  • You're doing desktop support and the company policy is that you can only help with company equipment. A user walks in:
    6·1 answer
  • Data elements in a relational database are organized into ____
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!