Semester : S1 and S2
Subject : Computer Programming
Year : 2018
Term : MARCH
Branch : BIOTECHNOLOGY
Scheme : 2015 Full Time
Course Code : CS 100
Page:10
accidentally.
remain safe, they cannot be modifiedarguments is possible within from called
function; therefore the code must handle
arguments’ carefully else ںہ get
unexpected results.
#include
*/
int main() /* Main function */
{
int n1 = 10, n2 = 20;
/* actual argurrents will be as it is 7
swapByValue(n1, ೧2);
printf("n1: %d,n2: %d\n", n1, n2}
ச்
void swapByValue(int a, int b)
OUTPUT
11: 10, ೧2: 20
void swapByValue(int, int); /* Prototype void
#include
swapByReference(int*, int*); /*
Prototype */
int main() /* Main function */
{
int n1 = 10, n2 = 20;
/* actual arguments wil be altered */
swapByReference(&n1, &n2);
printf("n1: %d, ೧2: 9605", ೧1, ೧2);
ச்
void swapByReference(int *a, int *b)
{
int t;
t= *a; *a = *b; *b =t;
7
OUTPUT
ni: 20, ೧2: 10
10
formal parameter — the identifier used in a method to stand for the value that is passed into
the method by a caller.
actual parameter — the actual value that is passed into the method by a caller.
11.