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...

program for swapping two strings by using pointers in c language

Answer Posted / umesh

#include <stdio.h>
void fastSwap (char **k, char **l)
{
char *t = *k;
*k = *l;
*l = t;
}
int main ()
{
char num1[] = "abc";
char num2[] = "def";
fastSwap ((char**)&num1,(char**)&num2);
printf ("%s\n",num1);
printf ("%s\n",num2);
return 0;
}

Is This Answer Correct ?    9 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can a pointer point to null?

1039


What is structure packing in c?

1039


Can 'this' pointer by used in the constructor?

1056


What is the difference between c &c++?

1105


Is fortran faster than c?

1011


What is #include cctype?

1085


What is a nested loop?

1085


A text file that contains declarations used by a group of functions,programs,or users a) executable file b) header file c) obj file d) .cfile

1067


The % symbol has a special use in a printf statement. Explain how would you place this character as part of the output on the screen?

1163


Tell me what is the purpose of 'register' keyword in c language?

978


What is identifiers in c with examples?

1143


What is a static function in c?

1129


Explain how do you determine the length of a string value that was stored in a variable?

1111


What is declaration and definition in c?

1039


When a c file is executed there are many files that are automatically opened what are they files?

1074