Posts

Showing posts with the label Call by Value

Call by Value and Call by Reference Method in C Language (C भाषा में कॉल बाय वैल्यू और कॉल बाय रिफरेन्स मेथड)

In C language, arguments can be passed to a function in different ways. Two commonly taught methods are Call by Value and Call by Reference (using pointers). These methods determine how a function receives and works with the values of variables. C भाषा में Function को Arguments अलग-अलग तरीकों से पास किए जा सकते हैं। दो प्रमुख तरीके Call by Value और Call by Reference (Pointers का उपयोग करके) हैं। ये तरीके निर्धारित करते हैं कि Function variables की values को किस प्रकार प्राप्त और उपयोग करता है। 1. Call by Value Method (कॉल बाय वैल्यू मेथड) In Call by Value method, the values of actual arguments are copied into the formal arguments. Any changes made to the formal arguments inside the function do not affect the original variables. Call by Value Method में Actual Arguments की values को Formal Arguments में कॉपी किया जाता है। Function के अंदर Formal Arguments की values में किए गए बदलाव Original Variables को प्रभावित नहीं करते हैं। Characteristics of Call by Value (विशेषताएँ) The values of a...

C Program to Swap Values of Two Variables Using Function (Call by Value) फंक्शन (कॉल बाय वैल्यू ) का उपयोग करके दो वेरिएबल की वैल्यू स्वैप करने का C प्रोग्राम

In C language, Call by Value is a method of passing arguments to a function in which copies of the actual arguments are passed to the function. Any changes made to the formal arguments do not affect the original variables. C भाषा में Call by Value एक ऐसी विधि है जिसमें function को actual arguments की copies पास की जाती हैं। Function के अंदर formal arguments में किए गए बदलाव original variables को प्रभावित नहीं करते हैं। C Program #include <stdio.h> void swap(int x, int y); int main(void) { int a, b; printf("Enter two integer numbers:\n"); scanf("%d %d", &a, &b); printf("Before swapping: A = %d and B = %d\n", a, b); swap(a, b); printf("After function call: A = %d and B = %d\n", a, b); return 0; } void swap(int x, int y) { int z; z = x; x = y; y = z; printf("Inside swap function: A = %d and B = %d\n", x, y); } Output Enter two integer numbers: 10 20 Before swapping: A = 10 and B...