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
How can I ensure that integer arithmetic doesnt overflow?
Create a structure to specify data on students given below: Roll number, Name, Department, Course, Year of joining Assume that there are not more than 450 students in the college. 1.write a function to print names of all students who joined in a particular year 2.write a function to print the data of a student whose roll number is given
program to find out date after adding 31 days to a date in the month of febraury also consider the leap year
What is stack in c?
In a header file whether functions are declared or defined?
Sir i need notes for structure,functions,pointers in c language can you help me please
Mention four important string handling functions in c languages .
int i=10; printf("%d %d %d", i, i=20, i);
How can I do serial ("comm") port I/O?
What is the use of a ‘ ’ character?
Can an array be an Ivalue?
Define Array of pointers.
What is the difference between local variable and global variable in c?
Difference between goto, long jmp() and setjmp()?
What is a stream water?