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 |
I came across some code that puts a (void) cast before each call to printf. Why?
what is real time system?what is the differance between hard and soft real time systems
How can I read a directory in a C program?
2 Answers Bright Outdoor, Wipro,
Difference between goto, long jmp() and setjmp()?
Can a function be forced to be inline? Also, give a comparison between inline function and the C macro?
What are the 4 types of programming language?
write a own function for strstr
what is disadvantage of pointer in C
What is volatile c?
1.)how to find d most repeated word in a string? string ="how do you do"?? output should be do
1 Answers AAS, Nagarro, Vuram,
Explain built-in function?
What is the difference between array and pointer?