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 |
What is static identifier?
When should a far pointer be used?
What is difference between && and & in c?
How can I generate floating-point random numbers?
What is null in c?
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..???
What are bit fields? What is their use?
Can we access the array using a pointer in c language?
Write code for initializing one dimentional and two dimentional array in a C Program?
5 Answers Deshaw, Edutech, GMD,
what is the stackpointer
write a c program to find largest number in matrix(in each row,each column, diagonally, and in the whole matrix)? Its urgent.
How the c program is executed?