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 difference between fread and fwrite function?
a formula,a series of steps,or well defined set of rules for solving a problem a) algorithem b) program c) erdiagram d) compiler
Explain void pointer?
What do you mean by dynamic memory allocation in c?
Write a code to determine the total number of stops an elevator would take to serve N number of people.
int a=20; int b=30; int c=40; printf("%d%d%d"); what will be the output?
#include<stdio.h> main() { int a[3]; int *I; a[0]=100;a[1]=200;a[2]=300; I=a; Printf(“%d\n”, ++*I); Printf(“%d\n”, *++I); Printf(“%d\n”, (*I)--); Printf(“%d\n”, *I); } what is the o/p a. 101,200,200,199 b. 200,201,201,100 c. 101,200,199,199 d. 200,300
proc() { static i=10; printf("%d",i); } If this proc() is called second time, what is the output?
convert 0.9375 to binary
Read two numbers from keyboard and find maximum of them?
How do you print only part of a string?
Why enum is used in c?