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 |
Name the language in which the compiler of "c" in written?
What is the difference b/w Structure & Array?
What is null pointer constant?
what is a function prototype?
Array is an lvalue or not?
How can I access memory located at a certain address?
Where is volatile variable stored?
Where static variables are stored in c?
By using C language input a date into it and if it is right?
Explain the difference between getch() and getche() in c?
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?
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