Home / Programs / Write C a program that uses a function show call by value mechanism.
🚀 Programming Example

Write C a program that uses a function show call by value mechanism.

👁 911 Views
💻 Practical Program
📘 Step Learning
Write C a program that uses a function show call by value mechanism.

💻 Program Code

#include <stdio.h>

int mul_by_10(int num); /* function prototype */

int main(void)
{
	int result,num = 3;
	printf("\n num = %d before function call.", num);
	result = mul_by_10(num);
	printf("\n result = %d after return from function", result);
	printf("\n num = %d", num);
	return 0;
}

/* function defi nition follows */

int mul_by_10(int num)
{
	num *= 10;
	return num;
}
 
                        

🖥 Program Output


 num = 3 before function call.
 result = 30 after return from function
 num = 3
 
                            

📘 Explanation

None
📚 Learning Subject

Master Programming Through Practical Examples

Improve your coding logic, problem-solving skills and programming confidence by practicing real-world examples with explanations.

🎯 How to learn from this example

First understand the algorithm carefully. Then study the program line-by-line and compare it with the output. Finally, review the explanation section to strengthen your logic and programming understanding.

🔥 Practice suggestion

Rewrite the program without looking at the code. Modify values, conditions or logic and run it again. This helps improve confidence and strengthens coding skills much faster.