write C code to reverse a string such that if i/p is "abc
defg hij klmno pqrs tuv wxyz"
and the o/p should be "cba gfed jih onmlk srqp vut zyxw"
Answer Posted / naresh
man()
{
char ch[33];
printf("enter the string");
for(int i=0;i<33;i++)
scanf("%c",&ch[i]);
int k=0;
for(i=0;ch[i]!='/o';i++)
{
if(ch[i]==" ")
{ int n=i;
while(i>=k)
{
printf("%c",ch[i]);
i--;
}
k=n;
}
}
}
| Is This Answer Correct ? | 3 Yes | 1 No |
Post New Answer View All Answers
How to get string length of given string in c?
What are the advantage of c language?
What is the meaning of c in c language?
Can we declare variable anywhere in c?
What are lookup tables in c?
How can I invoke another program (a standalone executable, or an operating system command) from within a c program?
Explain union. What are its advantages?
What is #include stdio h?
What is merge sort in c?
What is a pointer and how it is initialized?
What are the types of data types and explain?
Do pointers store the address of value or the actual value of a variable?
Can a variable be both static and volatile in c?
What does. int *x[](); means ?
The number of bytes of storage occupied by short, int and long are a) 2, 2 and 4 b) 2, 4 and 4 c) 4, 4 and 4 d) none