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                      
tip   To Refer this Site to Your Friends   Click 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
How to write a program for swapping two strings without 
using 3rd variable and without using string functions.
 Question Submitted By :: 12
I also faced this Question!!     Rank Answer Posted By  
 
  Re: How to write a program for swapping two strings without using 3rd variable and without using string functions.
Answer
# 1
main()
{
 int a=5,b=3;
b=a+b;
a=b-a;
b=b-a;
printf(" %d   %d ",a,b);
}
 
Is This Answer Correct ?    8 Yes 9 No
Biswambar
 
  Re: How to write a program for swapping two strings without using 3rd variable and without using string functions.
Answer
# 2
main()
{
 int a=5,b=3;
a=a+b;
b=a-b;
a=a-b;
printf(" %d   %d ",a,b);
getch();
}
 
Is This Answer Correct ?    10 Yes 8 No
Sri
 
 
 
  Re: How to write a program for swapping two strings without using 3rd variable and without using string functions.
Answer
# 3
Questions is to swap the string  not for integers so the
above answers are wrong.
 
Is This Answer Correct ?    12 Yes 2 No
Sivaraj
 
  Re: How to write a program for swapping two strings without using 3rd variable and without using string functions.
Answer
# 4
void main()
{
 char *p="string1";
 char *q="string2";

 p^=q^=p^=q;
 printf("%s,%s",p,q);
}

swapping the base pointers of the two strings may work... 
if they are declared as character arrays, then it is not 
possible as we cannot modify the value of array base 
pointers...
 
Is This Answer Correct ?    3 Yes 5 No
Saptarshi
 
  Re: How to write a program for swapping two strings without using 3rd variable and without using string functions.
Answer
# 5
main()
{
 int a=5,b=3;
a=a+b;
b=a-b;
a=a-b;
printf(" %d   %d ",a,b);
getch();
}
 
Is This Answer Correct ?    1 Yes 1 No
Srinath, Hyd
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
how to convert binary to decimal and decimal to binary in C lanaguage  4
consider the following program sigment int n,sum=1; switch(n) { case 2:sum=sum+2; case 3:sum*=2; break; default:sum=0;} if n=2, what is the value of sum a.0 b.6 c.3 d.none TCS4
10. Study the code: void show() main() { show(); } void show (char *s) { printf("%sn",s); } What will happen if it is compiled & run on an ANSI C Compiler? A)It will compile & nothing will be printed when it is executed B)it will compile but not link C)the compiler will generate an error D)the compiler will generate a warning Accenture4
HOW CAN ADD OUR FUNCTION IN LIBRARY.  5
what is diff between localstatic and globalstatis variable possible 2 use in another file...? HCL2
post new interiew question and aptitude test papers  1
How to set a variable in the environment list?  1
Write code for initializing one dimentional and two dimentional array in a C Program? Deshaw5
In the following control structure which is faster? 1.Switch 2.If-else and which consumes more memory?  4
What is the Difference between Class and Struct? Motorola9
without using arithmatic operator convert an intger variable x into x+1  1
pgm in c to reverse string by word using array(god is love becomes love is god) (no additional array can used,space is only delimiter between words ) Persistent1
sir, i cannot find the way how to write aprogram by using array on queue IISIT1
without a terminator how can we print a message in a printf () function. NIIT5
C program code int zap(int n) { if(n<=1)then zap=1; else zap=zap(n-3)+zap(n-1); } then the call zap(6) gives the values of zap [a] 8 [b] 9 [c] 6 [d] 12 [e] 15 Wipro4
Can you think of a way when a program crashed before reaching main? If yes how?  2
Write a C++ program without using any loop (if, for, while etc) to print numbers from 1 to 100 and 100 to 1;  7
1. Write the function int countchtr(char string[ ], int ch); which returns the number of times the character ch appears in the string. Example, the call countchtr(“She lives in NEWYORK”, ‘e’) would return 3.  2
How to add two numbers without using arithmetic operators? Sapient11
sqrt(x+sqrt(x+sqrt(x+sqrt(x))))=2; Find the value of x? Subex2
 
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