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?

Answer Posted / shruti

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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is cohesion in c?

545


cin.ignore(80, _ _);This statement a) ignores all input b) ignores the first 80 characters in the input c) ignores all input till end-of-line d) iteration

640


What are the keywords in c?

646


Explain what is wrong with this program statement?

624


Write a programme using structure that create a record of students. The user allow to add a record and delete a record and also show the records in ascending order.

1624






Explain logical errors? Compare with syntax errors.

633


What is the maximum length of an identifier?

667


What is 02d in c?

639


4-Take two sets of 5 numbers from user in two arrays. Sort array 1 in ascending and array 2 in descending order. Perform sorting by passing array to a function mySort(array, sortingOrder). Then multiply both the arrays returned from function, using metric multiplication technique in main. Print result in metric format.

1731


How many keywords (reserve words) are in c?

625


why we wont use '&' sing in aceesing the string using scanf

1787


can any one please explain, how can i access hard disk(physical address)? it is possible by the use of far,near or huge pointer? if yes then please explain......

1415


What is bss in c?

609


What is function definition in c?

590


What is data structure in c and its types?

598