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



how to reverse string "Hello World" by using pointers only. Without any temp var..

Answer / 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

More C Interview Questions

What is openmp in c?

0 Answers  


Which is best linux os?

0 Answers  


What is wrong with this statement? Myname = 'robin';

0 Answers  


i want to know the procedure of qualcomm for getting a job through offcampus

0 Answers   HCL,


dennis ritchie invented C language in AT&T bell laboratory what is the extension of AT&T?

4 Answers  


what is the maximum no. of bytes calloc can allocate

4 Answers   Mphasis,


Can we declare function inside main?

0 Answers  


Describe the modifier in c?

0 Answers  


When we use void main and int main?

0 Answers  


what about "char *(*(*a[])())();"

3 Answers   Oracle,


Which of the following is not an infinite loop ? a.while(1){ .... } b.for(;;){ ... } c.x=0; do{ /*x unaltered within theloop*/ ... }while(x==0); d.# define TRUE 0 ... while(TRUE){ .... }

7 Answers   TCS,


Write a program to input the price of 1 burger and the number of burgers eaten by a group of friends .print the total amount to be paid by the group?

0 Answers  


Categories