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

In a switch statement, explain what will happen if a break statement is omitted?

0 Answers  


char ch=10;printf("%d",ch);what is the output

14 Answers   Accenture,


Are comments included during the compilation stage and placed in the EXE file as well?

0 Answers  


Why is c fast?

0 Answers  


can we execute the program with the object file

1 Answers  






Is file a keyword in c?

0 Answers  


write a program to find lcm and hcf of two numbers??

1 Answers  


What is a floating point in c?

0 Answers  


find the output of the following program main() { int x=5, *p; p=&x; printf("%d",++*p); }

10 Answers   Amdocs, TCS,


how to convert an char array to decimal array

4 Answers  


What functions are in conio h?

0 Answers  


How do shell structures work?

0 Answers  


Categories