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 / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can a program have two main functions?

575


What is extern storage class in c?

517


Write programs for String Reversal & Palindrome check

601


What is putchar() function?

640


Is c weakly typed?

581






Explain what are the __date__ and __time__ preprocessor commands?

596


Can the sizeof operator be used to tell the size of an array passed to a function?

622


write a c program for swapping two strings using pointer

2098


Is null always equal to 0(zero)?

589


What are actual arguments?

649


Explain how does free() know explain how much memory to release?

575


What is a MAC Address?

633


Explain data types & how many data types supported by c?

588


Why functions are used in c?

592


Explain logical errors? Compare with syntax errors.

633