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 |
a character variable can at a time store a) 1 character b) 8 characters c) 254 characters d) none of the above
Is void a keyword in c?
#include<stdio.h> #include<conio.h> void main() { char ch='\356'; printf("%d",ch); } o/p=-18 why?plz.explain
Difference between goto, long jmp() and setjmp()?
a linear linked list such that the link field of its last node points to the first node instead of containing NULL a) linked list b) circular linked list c) sequential linked list d) none
How to avoid structure padding in C?
What does %2f mean in c?
Can you please explain the difference between syntax vs logical error?
What are 'near' and 'far' pointers?
Taking an example,differentiate b/w loader and linker ?
#include<std.h> int main() { char *str[]={"Frogs","Do","Not","Die","They","Croak!"}; printf("%d %d\n",sizeof(str),strlen(str)); ...return 0; } what will the output of the above program?
please explain every phase in the "SDLC" in the dotnet.