Question

Explain the concept of call by reference, with suitable code in C for each. Give advantage and disadvantage of call by reference

27 Apr 2023
Answer :
Word Count : 643

In C programming, the concept of "call by reference" allows a function to modify the value of a variable in the calling code by passing its memory address instead of the actual value. This means that any changes made to the parameter within the function will affect the original variable outside the function.

To demonstrate this concept, let's consider an example using a swap function to interchange the values of two integers.

 #include <stdio.h> void swap(int *a, int *b) {     int temp = *a;     *a = *b;     *b = temp; } int main() {     int x = 10;     int y = 20;          printf("Before swap: x = %d, y = %d\n", x, y);    _____ __________ __________ ________ ____ _______ __________ ________ ____ _____ ____.
___ ______ ____ ________ ____ ___ ______ ________.
_____ ___ __________ __________ ______ ________ ___.
_____ ___ _____ ______ ________ ______.
_______ ____ __________ _______ ___ ______ _____ _________ __________ ___.
__________ ________ ___ ______ __________.
______ _____ ______ _________ _________ _____ ____ ________ _____ _______.
___ _____ ______ ___ _______ _______ ___ _________ ____.
__________ ______ ___ ____ _____.
_________ _______ ________ _______ __________ __________.
______ __________ ________ ____ ________ __________ _______ _____ ______.
_____ _______ ____ ___ _________ _____ ____ ____ _____.
_______ ___ _______ _____ _________ _________ ____ _________.
________ _____ __________ ___ _________ ________ _____.
________ ___ __________ ______ ____ ______.
____ ____ ___ _____ ________ _________ _______.
____ __________ _____ ______ ________ __________ ____.
________ __________ _______ _________ _________ __________ ____ ___ _______ _________ ______.
______ _______ ____ _______ _______ ____ ____ ______.
___ ________ ______ _______ _____ _______ ______ _____ ___ __________.
______ _________ _________ ________ ______ __________ __________ __________ _____ __________ ______ _______.
_______ ____ __________ __________ _________ __________ ______ __________ _____ ________ ___.
___ __________ ________ _______ ________ ________ ______ ________ _______ ___ __________ ____.
____ _________ ____ _____ _______ ____ ______ ______.
_________ ______ ___ ____ ________.
_________ ___ ________ _______ ________ ____ ________.
_______ ____ ____ ___ ____.
________ ________ _______ __________ __________ _________ ______ ____ _____ _________ __________ _________.
_______ _________ ____ _____ ______ _______.
_____ ______ _________ _________ ____ ________ _______ ________ _____ ________ ______ ______.
________ ___ _______ _________ _______ __________ ___ ____.
_______ _______ ________ ________ ___ ________ ____ ___ _______ __________ _______ _______.
____ ___ ____ ____ ______ _______ ________ _____ ______ ___ _________.
____ __________ __________ _______ __________ ________ ____ ______ ________ ______ _________ __________.
____ __________ _____ _____ __________ ____ _________ ______ ________ _______ __________ _________.
____ __________ ___ ______ __________ _______.
_________ ________ __________ __________ ________ _________ _____ ___ ____ _______ ______ ____.
_____ ______ __________ ___ _______ __________ _____.
______ ___ ____ ______ _____ ________ _____ __________.
___ ____ ____ ___ _____.
______ __________ _________ _______ ________ ___ _______ _______ ________.
____ ___ ___ __________ ___ __________ ______ ____ ________ ___.
_______ _______ ___ ___ ________ _____ __________ ________ ___ ___ ____.
___ ______ _________ ___ __________ _________ ____ __________ ______ _____.
________ ________ __________ _________ ______ __________ ______ __________ _________ ___.
_______ _________ _________ __________ _________ __________ ______ ___ ________ _____ ____ ________.
_____ _______ ________ ______ ____ ___ ______.
____ ______ _______ ______ __________ __________ ______ ___ ______ _________ ___.
____ _______ _______ ___ ____.
_____ ______ _____ ______ ____.
______ ______ ______ ________ ______ ____ _______ ___.
_______ _____ ____ _______ _________ __________ _____.
______ ______ _________ ______ _________ ______ _________ ____ ____ ____.
________ _________ __________ ___ __________.
_________ _____ ______ ____ _____ ____ ___ ____ ____ _____.
___ _______ ___ _________ ______ _________ _____ __________ ________ _______ ________.
_________ _______ ______ ________ _________ _______ ___.
____ ____ _________ _______ ______ ________ ____ ________ ________ ________ ____ ______.
_________ ___ ________ _____ _____.
___ ________ ____ _________ ______ _____ ______.
__________.
Get Full Answer on WhatsApp
IGNOU NEWS
Assignment Submission Last Date Extended Till 30 June 2026 Click Here★★★IGNOU June 2026 TEE Date Sheet Released Click Here★★★
Top
📞
Call Support Instant phone assistance Explain the concept of call by reference, with suitable code in C for
🟢
WhatsApp Chat Fast live messaging
Email Us Business enquiries & support