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 |
What is difference between %d and %i in c?
What is typedef?
What are the disadvantages of a shell structure?
Without using main fn and semicolon,print remainder for a given number in C language
Why n++ execute faster than n+1 ?
Is a house a mass structure?
What is the scope of an external variable in c?
Are bit fields portable?
# define x=1+4; main() { int x; printf("%d%d",x/2,x/4); }
i got 75% in all semester am i eligible for your company
In the below code, how do you modify the value 'a' and print in the function. You'll be allowed to add code only inside the called function. main() { int a=5; function(); // no parameters should be passed } function() { /* add code here to modify the value of and print here */ }
what defference between c and c++ ?