6)swap(int x,y)
{
int temp;
temp=x;
x=y;
y=temp;
}
main()
{
int x=2;y=3;
swap(x,y);
}
after calling swap ,what are yhe values x&y?
Answers were Sorted based on User's Feedback
Answer / selloorhari
After calling the function swap(), the values of x,y will be
the same.
i.e. x = 2, y = 3.
The scope of the variables x,y,temp in the swap() function
lies inside the function swap() itself. So there will not be
any change in the values of x,y in the main() function..
| Is This Answer Correct ? | 17 Yes | 0 No |
the values will be x =2 and y = 3.
the variables x and y declared in main() are local to main.
whereas
the variables x and y declared in swap() are local to swap..
the change in the value of the variables in either
function will have zero effect on the other function.
Hence the value remains teh same.
| Is This Answer Correct ? | 16 Yes | 1 No |
Answer / shankar
Value remain same hare....I.E :- X=2,y=3.Because here rules of call by value is applied. If we use call by reference the only value is changed .
| Is This Answer Correct ? | 1 Yes | 0 No |
c programming of binary addition of two binary numbers
Can math operations be performed on a void pointer?
What is call by value in c?
Can we change the value of constant variable in c?
When should you use a type cast?
What is the purpose of & in scanf?
write a program fibonacci series and palindrome program in c
0 Answers Aditi Placement Service,
Can a function be forced to be inline? Also, give a comparison between inline function and the C macro?
How to print India by nested loop? I IN IND INDI INDIA
What's wrong with "char *p = malloc(10);" ?
What is the advantage of using #define to declare a constant?
0 Answers Agilent, ZS Associates,
State the difference between x3 and x[3].