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 do you mean by command line argument?
How can I read/write structures from/to data files?
GIVEN A FLOATING POINT NUMBER HOW IS IT ACTUALLY STORED IN MEMORY ? CAN ANYONE EXPLAIN?? THE 32 BIT REPRESENTATION OF A FLOATING POINT NUMBER ALLOTS: 1 BIT-SIGN 8 BITS-EXPONENT 23 BITS-MANTISSA
What is an expression?
What are run-time errors?
how to write hello word without using semicolon at the end?
main(){char *str;scanf("%s",str);printf("%s",str); }The error in the above program is: a) Variable 'str' is not initialised b) Format control for a string is not %s c) Parameter to scanf is passed by value. It should be an address d) none
Explain what header files do I need in order to define the standard library functions I use?
Can I use base-2 constants (something like 0b101010)? Is there a printf format for binary?
#ifdef TRUE int I=0; #endif main() { int j=0; printf("%d %d\n",i,j); }
Explain argument and its types.
What is character constants?