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 a constructor and how is it called?

1044


Do you know about latest advancements in C++ ?

1233


What are c++ stream classes?

1048


What are the effects after calling the delete this operator ?

1052


What is the use of vtable?

1146


How do I use turbo c++?

988


How do c++ struct differs from the c++ class?

1192


What do you mean by function pointer?

1102


What is helper in c++?

1087


How a macro differs from a template?

1168


Explain some examples of operator overloading?

1100


Can member data be public?

1032


What are static and dynamic type checking?

1079


What are put and get pointers?

1120


Evaulate: 22%5 a) 2 b) 4 c) 0

1086