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 |
what would be the output of the following program? main() { int k = 123; char *ptr; ptr = &k; printf("%d",*ptr); }
what is the use of ‘auto’ keyword?
Describe explain how arrays can be passed to a user defined function
What are local variables c?
the portion of a computer program within which the definition of the variable remains unchanged a) mode b) module c) scope d) none
Write a program in c using only loops to print * * * * * *******
Write a program to reverse a string.
0 Answers Global Logic, iNautix, TCS, Wipro,
Is Exception handling possible in c language?
Find duplicates in a file containing 6 digit number (like uid) in O (n) time.
What does typeof return in c?
What is clrscr in c?
Why is struct padding needed?