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
What are the valid places to have keyword “break”?
Which is best book for data structures in c?
There seem to be a few missing operators ..
What is the best organizational structure?
I just typed in this program, and it is acting strangely. Can you see anything wrong with it?
Subtract Two Number Without Using Subtraction Operator
In this assignment you are asked to write a multithreaded program to find the duplicates in an array of 10 million integers. The integers are between -5000,000 to 5000,000 and are generated randomly. Use 10 threads, each thread works on 1000,000 integers. Compare the time needed to accomplish the task with single thread of execution program. Do not include the time to fill the array with integers in the execution time.
The __________ attribute is used to announce variables based on definitions of columns in a table?
Write a C program to accept a matrix of any size. Find the frequency count of each element in the matrix and positions in which they appear in the matrix
What is the easiest sorting method to use?
What is a static function in c?
Is null equal to 0 in sql?
Write a program to print "hello world" without using a semicolon?
What is the maximum no. of arguments that can be given in a command line in C.?
What are the different file extensions involved when programming in C?