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
What does dm mean sexually?
What does return 1 means in c?
Which of the following operators is incorrect and why? ( >=, <=, <>, ==)
Explain how can I convert a string to a number?
"%u" unsigned integer print the a) address of variable b) value of variable c) name of a variable d) none of the above
What does 2n 4c mean?
When do you not use the keyword 'return' when defining a function a) Always b) Never c) When the function returns void d) dfd
Differentiate between a structure and a union.
What are linked lists in c?
Write a program to generate the Fibinocci Series
What is pass by reference in functions?
How many types of arrays are there in c?
What is the use of pragma in embedded c?
What is openmp in c?
What are header files? What are their uses?