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



program for swapping two strings by using pointers in c language ..

Answer / 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

More C Interview Questions

what would be the output of the following program? main() { int k = 123; char *ptr; ptr = &k; printf("%d",*ptr); }

4 Answers  


what is the use of ‘auto’ keyword?

1 Answers  


Describe explain how arrays can be passed to a user defined function

0 Answers  


What are local variables c?

0 Answers  


the portion of a computer program within which the definition of the variable remains unchanged a) mode b) module c) scope d) none

0 Answers  


Write a program in c using only loops to print * * * * * *******

2 Answers   IBM,


Write a program to reverse a string.

0 Answers   Global Logic, iNautix, TCS, Wipro,


Is Exception handling possible in c language?

0 Answers   Wipro,


Find duplicates in a file containing 6 digit number (like uid) in O (n) time.

0 Answers   GrapeCity,


What does typeof return in c?

0 Answers  


What is clrscr in c?

0 Answers  


Why is struct padding needed?

0 Answers  


Categories