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 is static identifier?

0 Answers   TCS,


When should a far pointer be used?

0 Answers   Aspire, Infogain,


What is difference between && and & in c?

0 Answers  


How can I generate floating-point random numbers?

0 Answers  


What is null in c?

0 Answers  






Is the C language is the portable language...If yes...Then Why...and if not then what is problem so it is not a Portable language..???

2 Answers   TCS,


What are bit fields? What is their use?

2 Answers   Adobe,


Can we access the array using a pointer in c language?

0 Answers  


Write code for initializing one dimentional and two dimentional array in a C Program?

5 Answers   Deshaw, Edutech, GMD,


what is the stackpointer

2 Answers  


write a c program to find largest number in matrix(in each row,each column, diagonally, and in the whole matrix)? Its urgent.

2 Answers  


How the c program is executed?

0 Answers  


Categories