Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is function prototype in c language?

1038


How can you tell whether a program was compiled using c versus c++?

1111


program to find error in linklist.(i.e find whether any node point wrongly to previous nodes instead of next node)

2106


Explain how can I make sure that my program is the only one accessing a file?

1228


What is use of #include in c?

1172


Why c is called free form language?

1025


Write a code to achieve inter processor communication (mutual exclusion implementation pseudo code)?

1127


An arrangement of information in memory in such a way that it can be easily accessed and processed by a programming language a) string b) data structure c) pointers d) array

1143


What are local static variables? How can you use them?

1154


Explain how can I convert a number to a string?

1154


What are the usage of pointer in c?

1201


What is the default value of local and global variables in c?

1049


What is modeling?

1063


Was 2000 a leap year?

1059


what is the format specifier for printing a pointer value?

1028