Jump to content
ChetanaSforum
Sign in to follow this  
chitkaraankit

Swapping Of Two Strings Without 3 rd Variable

Recommended Posts

#include<iostream.h>#include<conio.h>void main(){clrscr();char* p="Hello";char* q="World";p=(char*) ((int)p + (int)q);q=(char*) ((int)p - (int)q);p=(char*) ((int)p - (int)q);cout<<p<<" "<<q;getch();}

Share this post


Link to post
Share on other sites

#include<iostream.h>#include<conio.h>void main(){clrscr();char* p="Hello";char* q="World";p=(char*) ((int)p + (int)q);q=(char*) ((int)p - (int)q);p=(char*) ((int)p - (int)q);cout<<p<<" "<<q;getch();}

wat if two strings r given instead of pointer to string?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  



×