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 difference between strcmp & palindrome?

3 Answers  


write a program to find the given number is prime or not

2 Answers   Accenture, Vasutech,


Explain what is the best way to comment out a section of code that contains comments?

0 Answers  


what are two kinds of java

2 Answers  


What is the real difference between arrays and pointers?

27 Answers   Hexaware, Logic Pro, TCS,






convert 12345 to 54321 withoutusing strig

5 Answers  


What is volatile

2 Answers  


GIVEN A FLOATING POINT NUMBER HOW IS IT ACTUALLY STORED IN MEMORY ? CAN ANYONE EXPLAIN?? THE 32 BIT REPRESENTATION OF A FLOATING POINT NUMBER ALLOTS: 1 BIT-SIGN 8 BITS-EXPONENT 23 BITS-MANTISSA

0 Answers  


what is the difference between NULL & NUL keywords in C?

3 Answers  


Are enumerations really portable?

0 Answers  


main() { intj; while9j<=10) { printf("\n%d",j); j=j+1; } }

4 Answers  


Define Array of pointers.

0 Answers  


Categories