Clouds
Home
Tutorial of C language
Computer Language
Introduction to C
Programming in C
Structure of C program
Variable in C
Datatypes in C
Token in C
Operator in C
Precedence of C Operator
Assignment Operator in C
Logical Operator in C
Bitwise Operator in C
Ternary Operator in C
C Input Output
Pointers in C
Storage Classes of C
Control Structure of C
C Decision Making Statement
C Looping Statement
C Jumping Statement
C Function
Function Call By Value
Function Call By Reference
C Input Output Function
C Structure
Array in C
Union in C

Call-by-Value

In a Call-by-value technique a value is being passed as an argument to called call-by-value.

Example1:-

				#include<stdio.h>
				void sum(int a,int b)
				{
				  	int sum;
				 	sum=a+b;
				 	printf("Sum of a & b= %d",sum);
				}
				void  main()
				{
				 	int m,n;
				 	printf("Enter the value of m: ");
				 	scanf("%d",&m);
				 	printf("Enter the value of n: ");
				 	scanf("%d",&n);
				 	sum(m,n);
				}
				

Example2:-

				#include<stdio.h>
				#include<conio.h>
				void  high(int a,int b)
				{
				 	if(a>b)
				 		printf("Highest value=%d",a);
				 	else
				 		printf("Highest value=%d",b);
				}
				void  main()
				{
				 	int m,n;
					clrscr();
				 	printf("Enter the value of m: ");
				 	scanf("%d",&m);
				 	printf("Enter the value of n: ");
				 	scanf("%d",&n);
				 	high(m,n);
				}
				

Example3:-

				#include<stdio.h>
				#include<conio.h>
				void swap(int a,int b)
				{
				 	int tmp;
				 	tmp=a;
				 	a=b;
				 	b=tmp;
				 	printf("1st No=%d\n",a);
				 	printf("2nd N0=%d\n",b);
				}
				void main()
				{
				 	int m,n;
					clrscr();
					printf("Enter the 1st No.: ");
				 	scanf("%d",&m);
				 	printf("Enter the 2nd No.: ");
				 	scanf("%d",&n);
				 	swap(m,n);
					getch();
				}
				

Function Call By Reference >>
C Input Output Function >>
C Structure >>
Array in C >>
Union in C >>


Home Clouds