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 is the meaning of c in c language?
GIVEN A FLOATING POINT NUMBER HOW IS IT ACTUALLY STORED IN MEMORY ? CAN ANYONE EXPLAIN?? THE 32 BIT REPRESENTATION OF A FLOATING POINT NUMBER ALLOTS: 1 BIT-SIGN 8 BITS-EXPONENT 23 BITS-MANTISSA
Give differences between - new and malloc() , delete and free() ?
What is mean by Data Driven framework in QTP? Can any one answer me in details on this regard.
What is the difference between single charater constant and string constant?
Why is it important to memset a variable, immediately after allocating memory to it ?
What is bubble sort in c?
What is c definition?
What is the size of structure pointer in c?
the process of defining something in terms of itself is called (or) in C it is possible for the functions to call themselves. A function called a) nested function b) void function c) recursive function d) indifinite function
What is the size of a union variable?
write a c program in such a way that if we enter the today date the output should be next day's date.
Is it possible to have a function as a parameter in another function?
WRITE A CODE IN C TO SEARCH A FILE FROM NOTEPAD FILE.
What do header files do?