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 variable in c example?
what is the output of below code int x=8,y; x>>=2; y=x; what is y value. NOTE:EXPLANATION IS COMPALSARY with binary bits
the maximum length of a character constant can be a) 1 character b) 8 characters c) 256 chaacters d) 125 characters
write a program for even numbers?
Explain b+ tree?
HOW TO FIND OUT THE RREVERS OF A GIVEN DIGIT NUMBER IF IT IS INPUT THROUGH THE KEYBORD BY USING C LANGUAGE
Why is c known as a mother language?
1 1 1 1 2 1 1 3 3 1 1 4 6 4 1
What is your stream meaning?
main() { int a,b; printf("%d,%d",scanf("%d%d",&a,&b)); } => do u mean above program's output... =>output will be:2,whatever you enter value for b. =>because scanf is a library fn which will return how many arguements it processes, and second value you are right mr.Satya but i found my self unable to understand that for the first time scanf returns the no of successful matches but how for the second time it returns the value of 'b'.while a function should return the same 'r' value every time.
What is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?
How can I invoke another program from within a C program?