program for swapping two strings by using pointers in c language
Answer Posted / 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 View All Answers
In which language linux is written?
What does 3 mean in texting?
What is the use of printf() and scanf() functions?
Is it possible to execute code even after the program exits the main() function?
code for find determinent of amatrix
What is null in c?
What is include directive in c?
Where static variables are stored in memory in c?
what is the structure pointer?
What is the incorrect operator form following list(== , <> , >= , <=) and what is the reason for the answer?
Explain continue keyword in c
What is the scope of global variable in c?
how is the examination pattern?
1.int a=10; 2.int b=20; 3. //write here 4.b=30; Write code at line 3 so that when the value of b is changed variable a should automatically change with same value as b. 5.
Which of these functions is safer to use : fgets(), gets()? Why?