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
What is function in c with example?
Which is the best website to learn c programming?
What is #include conio h?
What is define c?
What is advantage of pointer in c?
What should malloc(0) do? Return a null pointer or a pointer to 0 bytes?
What is the Purpose of 'extern' keyword in a function declaration?
Here is a neat trick for checking whether two strings are equal
What is a function simple definition?
the statement while(i) puts the entire logic in loop. this loop is called a) indefinite loop b) definite loop c) loop syntax wrong d) none of the above
What is c language in simple words?
What is an endless loop?
Want to know how to write a C program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the total number of disk writes by MySQL.
What is the purpose of sprintf?
What are the primitive data types in c?