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
What are logical errors and how does it differ from syntax errors?
write a c program for swapping two strings using pointer
How can I invoke another program or command and trap its output?
‘SAVEPOINT’ and ‘ROLLBACK’ is used in oracle database to secure the data comment. Give suitable examples of each with sql command.
What does p mean in physics?
In cryptography, you could often break the algorithm if you know what was the original (plain) text that was encoded into the current ciphertext. This is called the plain text attack. In this simple problem, we illustrate the plain text attack on a simple substitution cipher encryption, where you know each letter has been substituted with a different letter from the alphabet but you don’t know what that letter is. You are given the cipherText as the input string to the function getwordSets(). You know that a plain text "AMMUNITION" occurs somewhere in this cipher text. Now, you have to find out which sets of characters corresponds to the encrypted form of the "AMMUNITION". You can assume that the encryption follows simple substitution only. [Hint: You could use the pattern in the "AMMUNITION" like MM occurring twice together to identify this]
What is the difference between procedural and functional programming?
i have a written test for microland please give me test pattern
How can you pass an array to a function by value?
Why is struct padding needed?
Who developed c language?
Why is sizeof () an operator and not a function?
Explain what is wrong with this program statement?
What is the use of header?
Is it possible to have a function as a parameter in another function?