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
How does selection sort work in c?
Why c is a mother language?
An arrangement of information in memory in such a way that it can be easily accessed and processed by a programming language a) string b) data structure c) pointers d) array
What are the 3 types of structures?
How can I change their mode to binary?
What are the different types of constants?
How do I get an accurate error status return from system on ms-dos?
what are # pragma staments?
What is function prototype?
GIven a sequence of characters. How will you convert the lower case characters to upper case characters. ( Try using bit vector - sol given in the C lib -> typec.h)
Explain how can you check to see whether a symbol is defined?
Why do some versions of toupper act strangely if given an upper-case letter?
What is stack in c?
If I have a char * variable pointing to the name of a function ..
What are the types of arrays in c?