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 |
If input is 123 then how to print 100 and 20 and 3 seperately?
What is this infamous null pointer, anyway?
What is switch in c?
What is declaration and definition in c?
What are the applications of c language?
Given an array of numbers, except for one number all the others occur twice. Give an algorithm to find that number which occurs only once in the array.
Why we use conio h in c?
struct tag{ auto int x; static int y; };main() { struct tag s; s.x=4; s.y=5; printf(ā%dā,s.x); }
What is a MAC Address?
find the output of the following program main() { int x=5, *p; p=&x; printf("%d",++*p); }
wat are the two methods for swapping two numbers without using temp variable??
What is the auto keyword good for?