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 the purpose of main() function?
Do you know pointer in c?
Is return a keyword in c?
How are pointers declared in c?
What is "Hungarian Notation"?
how can be easily placed in TCS.
a program that performs some preliminary processing in C, it acts upon certain directives that will affect how the compiler does its work a) compiler b) loader c) directive d) preprocessor
main() { char ch='356'; Printf("%d",ch); } *OUTPUT*:- -18 *Why?*
write a program to reverse the words in the sentence.NOTE:not reverse the entire string but just the occurance of each word
if (i = 0)printf ("True"); elseprintf("False"); Under what conditions will the above print out the string "True" a) Never b) Always c) When the value of i is 0 d) all of the above
what does keyword ‘extern’ mean in a function declaration?
What is header file definition?