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
any function have arguments one or more OR not . it is compulsary a) any function compulsary have one or more arguments b) any function did not have arguments. It is not compulsary c) it is optional it is not compulsary d) none of the above
What will be your course of action for a push operation?
Differentiate between null and void pointers.
What are the types of operators in c?
Create a structure to specify data on students given below: Roll number, Name, Department, Course, Year of joining Assume that there are not more than 450 students in the college. 1.write a function to print names of all students who joined in a particular year 2.write a function to print the data of a student whose roll number is given
Why do we write return 0 in c?
Tell me when would you use a pointer to a function?
What is a function in c?
What is union in c?
Explain what could possibly be the problem if a valid function name such as tolower() is being reported by the c compiler as undefined?
How to throw some light on the b tree?
What is data structure in c and its types?
What is #pragma statements?
What does 3 mean in texting?
what do you mean by enumeration constant?