pgm in c to reverse string by word using array(god is love
becomes love is god)
(no additional array can used,space is only delimiter
between words )
Answer Posted / charan
#include <stdio.h>
#include <conio.h>
void main()
{
char *str;
char s[10][10];
int i=0,j=0,p=0;
clrscr();
printf("Enter the string");
gets(str);
while(str)
{
if(str[i]!=' ')
s[j][p++]=str[i];
else
{
s[j][p++]='\0';
p=0;
}
i++;
}
for(i=j;i>=0;i--)
puts(s[i]);
getch();
}
| Is This Answer Correct ? | 1 Yes | 10 No |
Post New Answer View All Answers
Why c is a mother language?
What is the difference between declaring a variable and defining a variable?
Write a programme using structure that create a record of students. The user allow to add a record and delete a record and also show the records in ascending order.
What are the differences between Structures and Arrays?
Why is this loop always executing once?
Is exit(status) truly equivalent to returning the same status from main?
What is null pointer in c?
What is exit() function?
Difference between MAC vs. IP Addressing
Array is an lvalue or not?
How pointers are declared?
What is a program?
What is the use of a ‘ ’ character?
What is the size of array float a(10)?
Can the “if” function be used in comparing strings?