How to write a program for swapping two strings without
using 3rd variable and without using string functions.
Answer Posted / saptarshi
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 ? | 10 Yes | 26 No |
Post New Answer View All Answers
write a c program thal will find all sequences of length N that produce the sum is Zero, print all possible solutions?
Explain what header files do I need in order to define the standard library functions I use?
How can I write a function analogous to scanf?
What is the heap in c?
How do you print only part of a string?
What is the difference between local variable and global variable in c?
How to write a program for machine which is connected with server for that server automatically wants to catch the time for user of that machine?
Calculate 1*2*3*____*n using recursive function??
How reliable are floating-point comparisons?
What are the types of data types and explain?
Why do we use return in c?
How many bytes are occupied by near, far and huge pointers (dos)?
What is the explanation for modular programming?
What does s c mean in text?
What is abstract data structure in c?