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

Write about the stack unwinding?

1026


What is doubly linked list in c++?

1036


What is class syntax c++?

1105


Define what is constructor?

1014


Which programming language should I learn first?

1057


Is it possible to get the source code back from binary file?

1308


What is setfill c++?

1103


What is the use of dot in c++?

1045


Difference between overloading vs. Overriding

1044


Can we make any program in c++ without using any header file and what is the shortest program in c++.

1086


What is an operator in c++?

1014


How do you show the declaration of a virtual constructor?

905


What is a virtual destructor? Explain the use of it?

957


What is a down cast?

1056


What type of question are asked in GE code writing test based on c++ data structures and pointers?

3932