how to reverse string "Hello World" by using pointers only.
Without any temp var
Answer Posted / aravind
#include<stdio.h>
char reverse(char *, char *);
int main()
{
char a[]="hello"
char b[]="world";
gets(a,b);
puts(a); /*displays Hello world*/
reverse(a,b);
char reverse(char *ptr, char *ptr1)
{
int i,j;
for(i=0;i!='\0';i++)
{
printf("%s",*ptr);
ptr++;
}
for(j=0;j!='\0';j++)
{
printf("%s",*ptr1);
ptr1++;
}
gets(*ptr1,*ptr);
puts(*ptr1); /*displays world hello*/
}
| Is This Answer Correct ? | 0 Yes | 10 No |
Post New Answer View All Answers
Where static variables are stored in c?
Explain threaded binary trees?
When we use void main and int main?
Read the following data in two different files File A: aaaaaaaadddddddd bbbbbbbbeeeeeeee ccccccccffffffff File B: 11111111 22222222 33333333 By using the above files print the following output or write it in the Other file as follows aaaaaaaa11111111dddddddd bbbbbbbb22222222eeeeeeee cccccccc33333333ffffffffffff
Explain what is the difference between the expression '++a' and 'a++'?
Difference between linking and loading?
how to write a c program to print list of fruits in alpabetical order?
Which control loop is recommended if you have to execute set of statements for fixed number of times?
pierrot's divisor program using c or c++ code
how could explain about job profile
How many data structures are there in c?
What are structure types in C?
Give basis knowledge of web designing ...
Difference between pass by reference and pass by value?
What is static memory allocation?