Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Write a program to swap 2 chars without using a third
varable?
char *s = "A";
char *p = "B";

Answer Posted / koushik sarkar

#include<stdio.h>
void swap(char *p,char *s){*p=*p+*s-(*s=*p);}
int main()
{
char a,b;
a='A';b='B';
printf("a=%c,b=%c",a,b);
swap(&a,&b);
printf("a=%c,b=%c",a,b);
return 0;
}

Is This Answer Correct ?    4 Yes 11 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is the difference between overloading & overriding? give example.

1199


Explain the concept of copy constructor?

1057


What is purpose of abstract class?

1074


Why is c++ not purely object oriented?

1015


What is atoi?

978


Can we declare a base-class destructor as virtual?

1014


Explain all the C++ concepts using examples.

1213


What is flag in computer?

1058


Why do we use the using declaration?

1181


What is boyce codd normal form in c++?

1161


What is the first name of c++?

1073


what is COPY CONSTRUCTOR and what is it used for?

1077


What is const pointer and const reference?

1172


Which is the best c++ compiler for beginners?

1101


Who invented turbo c++?

1073