1. what do you mean by swapping?
Ans- Swapping two number in C
programming language means exchanging
the values of two variables. Suppose you
have two variable var1 & var2. Value of
var1 is 20 & value of var2 is 40. So, after
swapping the value of var1 will become 40
& value of var 2 will become 20.
#include<stdio.h>
int main() {
double first, second, temp;
printf("Enter first number: ");
scanf("%lf", &first);
printf("Enter second number: ");
scanf("%lf", &second);
// value of first is assigned to temp
temp = first;
, // value of second is assigned to first
first = second;
// value of temp (initial value of first) is
assigned to second
second = temp;
// %.2lf displays number up to 2 decimal
points
printf("\nAfter swapping, first number =
%.2lf\n", first);
printf("After swapping, second number =
%.2lf", second);
return 0;
}
Two types of swapping basically
a. call by value
b. call by reference
,2.what is token?
Ans- Tokens in C is the most important
element to be used in creating a program
in C. We can define the token as the
smallest individual element in C. For
`example, we cannot create a sentence
without using words; similarly, we cannot
create a program in C without using tokens
in C. Therefore, we can say that tokens in C
is the building block or the basic
component for creating a program in C
language.
o Keywords in C
o Identifiers in C
o Strings in C
, o Operators in C
o Constant in C
o Special Characters in C
3.what do you mean by call by value?
Ans- The call by value method of passing
arguments to a function copies the actual
value of an argument into the formal
parameter of the function. In this case,
changes made to the parameter inside the
function have no effect on the argument. By
default, C programming uses call by value
to pass arguments.
/* function definition to swap the values */
void swap(int x, int y) {
int temp;
temp = x; /* save the value of x */
x = y; /* put y into x */