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
Explain how do you search data in a data file using random access method?
Describe dynamic data structure in c programming language?
What should malloc(0) do?
Explain do array subscripts always start with zero?
What is a sequential access file?
Explain how can I remove the trailing spaces from a string?
Combinations of fibanocci prime series
Explain is it better to bitshift a value than to multiply by 2?
can we change the default calling convention in c if yes than how.........?
What does 1f stand for?
pierrot's divisor program using c or c++ code
what will be the output for the following main() { printf("hi" "hello"); }
There is a practice in coding to keep some code blocks in comment symbols than delete it when debugging. How this affect when debugging?
What are static variables in c?
What is data structure in c programming?