ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
info       Did you received any Funny E-Mails from your Friends and like to share with rest of our friends? Yeah!! you can post that stuff   HERE
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
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?
 Question Submitted By :: Guest
I also faced this Question!!     Rank Answer Posted By  
 
  Re: 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
# 1
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 ?    3 Yes 0 No
Selloorhari
 
  Re: 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
# 2
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 ?    3 Yes 0 No
Shruti
 
 
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
write a fuction for accepting and replacing lowercase letter to'Z' with out using inline function. Temenos4
which operator having highest precedence? a.)+ b.)++ c.)= d.)%  3
What are the uses of pre-processor directives?  2
program to find a smallest number in an array Microsoft5
f1() { f(3);} f(int t) { switch(t); { case 2: c=3; case 3: c=4; case 4: c=5; case 5: c=6; default: c=0;} value of c? Geometric-Software5
related to rdbms query .  1
what is the difference between structural,object based,object orientd programming languages? PanTerra1
What should be keep precautions while using the recursion method?  1
how to impliment 2 or more stacks in a single dimensional array ? iFlex1
what is the difference between these initializations? Char a[]=”string”; Char *p=”literal”; Does *p++ increment p, or what it points to?  2
how to implement stack work as a queue?  2
what is use of loop? Infosys6
declare afunction pointer to int printf(char *)? HCL1
void main() { int s[4][2]={ {1234,56},{1212,33},{1434,80},{1312,78} }; int (*p)[2]; int i,j,*pint; for(i=0;i<=3;i++) { p=&s[i]; pint=p; printf("\n"); for(j=0;j<=1;j++) printf("%d",*(pint+j)); } } while running this program it shows a warning-suspicious pointer conversion ie pint=p; my que is why should we assign the value of p to pint again.why cant we use it directly as *(p+j)..but if i use like tat the o/p is garbage value..  1
How can I access memory located at a certain address?  2
How do I access command-line arguments? Wipro2
how many times does the loop iterated ? for (i=0;i=10;i+=2) printf("Hi\n"); TCS7
Reverse a string word by word??  6
who will call your main function in c under linux?  2
which one is not preprocessor directive a)#if b)#elif c)#undef d)#pragma Wipro13
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com