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
Explain what is a pragma?
How do I determine whether a character is numeric, alphabetic, and so on?
How can I make it pause before closing the program output window?
How do you search data in a data file using random access method?
hello freinds next week my interview in reliance,nybody has an idea about it intervew questions..so tell
Explain the difference between strcpy() and memcpy() function?
Write a c program to build a heap method using Pointer to function and pointer to structure ?
Explain b+ tree?
Is javascript based on c?
What is the use of #include in c?
How to set file pointer to beginning c?
write a progrmm in c language take user interface generate table using for loop?
When can you use a pointer with a function?
Explain what is the difference between far and near ?
Explain what is the difference between the expression '++a' and 'a++'?