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
Consider the security of a mobile device you use
Alekssandra [29.7K]

Answer:

keep it private

Explanation:

7 0
2 years ago
A _____ attack floods a network or server with service requests to prevent legitimate users' access to the system. phishing back
Ad libitum [116K]
Denial-of-service is correct 
4 0
2 years ago
You recently purchased a new laptop for home. You want to ensure that you are safe from malware. You should install a personal _
german

Answer:

You should install a personal firewall, a program that protects your computer from unauthorized access by blocking certain types of communications.

Explanation:

In computing, a firewall is a network security system that monitors and controls incoming and outgoing network traffic based on predetermined security rules. A firewall typically establishes a barrier between a trusted internal network and untrusted external network, such as the Internet.

8 0
3 years ago
List three things to be safer online.
kenny6666 [7]

Answer:

1. do not give out your age

2. don't use your real name unless you are supervised

3.dont put all your information out there

5 0
2 years ago
Which of the following is NOT a network configuration?
wariber [46]
It's definitely not ring or bus either mesh or Ethernet
4 0
2 years ago
Read 2 more answers
Other questions:
  • The length of a hailstone sequence is the number of terms it contains. For example, the hailstone sequence in example 1 (5, 16,
    9·1 answer
  • Is instant messaging a form of synchronous communication
    10·1 answer
  • Which is the correct attribute syntax
    9·1 answer
  • How many Iron molecules are in the compound Fe4O2?
    15·2 answers
  • Alex’s family members live in different parts of the world. They would like to discuss the wedding plans of one of their distant
    7·2 answers
  • The force required to slide an object is equal to _____.
    13·1 answer
  • A representation of something by using a description, summary or image.
    7·1 answer
  • I made a mistake. I'm building my first PC and I bought a Ryzen 7 3800x and planning on getting a 2070 super (if I can). What I
    9·1 answer
  • Pls help it’s on a test!! no links :) you can zoom in if hard to read
    15·1 answer
  • ____ the most popular word processing applications software<br><br>​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!