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

Name the language in which the compiler of "c" in written?

3 Answers   Bajaj,


What is the difference b/w Structure & Array?

6 Answers  


What is null pointer constant?

0 Answers  


what is a function prototype?

1 Answers  


Array is an lvalue or not?

0 Answers  






How can I access memory located at a certain address?

3 Answers   Verizon,


Where is volatile variable stored?

0 Answers  


Where static variables are stored in c?

0 Answers  


By using C language input a date into it and if it is right?

0 Answers   Aricent,


Explain the difference between getch() and getche() in c?

0 Answers  


Why data types in all programming languages have some range? Why ritche have disigned first time likethat?Why not a single data type can support all other types?

2 Answers   Excel,


What is true about the following C Functions (a) Need not return any value (b) Should always return an integer (c) Should always return a float (d) Should always return more than one value

2 Answers   DynPro, TCS,


Categories