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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the types of arrays in c?

727


What is a loop?

667


What are structure types in C?

762


Difference between strcpy() and memcpy() function?

775


What is the difference between printf and scanf in c?

869






Explain b+ tree?

730


Explain the properties of union.

705


why programs in c are running with out #include? some warnings are display in terminal but we execute the program we get answer why? eg: main() { printf("hello world "); }

1408


Explain the difference between getch() and getche() in c?

645


What is the best organizational structure?

750


How do I swap bytes?

723


How can I make sure that my program is the only one accessing a file?

793


What is a node in c?

650


Write a C program to count the number of email on text

1510


A collection of functions,calls,subroutines or other data a) library b) header files c) set of files d) textfiles

752