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

What is the difference between text files and binary files?

1346


Synonymous with pointer array a) character array b) ragged array c) multiple array d) none

1058


What is bin sh c?

1026


If i have an array 0 to 99 i.e,(Size 100) I place the values 1 to 100 randomly like a[0]=29,a[1]=56 upto array[99].. the values are only between 1 to 100. getting the array values by using scanf.. If i entered one wrong element value line a[56]=108. how can i find it.. and also how to find the missing value in 1 to 100.. and i want to replace the missing values.. any one of them know please post your answer..

2017


swap 2 numbers without using third variable?

1124


What is the importance of c in your views?

1170


What is the general form of #line preprocessor?

991


What is this infamous null pointer, anyway?

1047


Is c pass by value or reference?

1033


What is the difference between test design and test case design?

2086


Explain how can you tell whether a program was compiled using c versus c++?

1100


Why clrscr is used in c?

1014


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

1271


What is "Hungarian Notation"?

1106


What is an array? What the different types of arrays in c?

1176