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


Please Help Members By Posting Answers For Below Questions

what is the format specifier for printing a pointer value?

609


List the difference between a 'copy constructor' and a 'assignment operator' in C?

637


Explain indirection?

645


How can a program be made to print the line number where an error occurs?

649


What are qualifiers and modifiers c?

546






What is the difference between array and structure in c?

568


What are valid operations on pointers?

666


What is the use of putchar function?

649


How does placing some code lines between the comment symbol help in debugging the code?

544


What does the format %10.2 mean when included in a printf statement?

1084


How can you find out how much memory is available?

614


What is the difference between typedef struct and struct?

595


What are two dimensional arrays alternatively called as?

658


How many main () function we can have in a project?

610


Explain what does the characters 'r' and 'w' mean when writing programs that will make use of files?

756