pgm to reverse string using arrays i.e god is love becomes
love is god)
(assumption:only space is used for seperation of words)
no addtional memory used.i.e no temporary arrays can used.
Answer Posted / ruchi
#include<stdio.h>
#include<conio.h>
int main()
{
int i=0,c;
char a[20];
printf("\nEnter the string");
while((a[i++]=getchar())!='\n');
printf("\nReverse of the string is ");
for(c=i;c>=0;c++)
{
printf("%c"a[c]);
}
getch();
}
| Is This Answer Correct ? | 1 Yes | 5 No |
Post New Answer View All Answers
What is LINKED LIST? How can you access the last element in a linked list?
What are the different types of endless loops?
Explain what is the benefit of using an enum rather than a #define constant?
Find the second largest element in an array with minimum no of comparisons and give the minimum no of comparisons needed on an array of size N to do the same.
What is the use of header files?
When can a far pointer be used?
What are dangling pointers in c?
What is the data segment that is followed by c?
application attempts to perform an operation?
What is c language and why we use it?
What is a lookup table in c?
Does c have circular shift operators?
How do you redirect a standard stream?
What is the basic structure of c?
Explain the difference between the local variable and global variable in c?