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 isn't any of this standardized in c? Any real program has to do some of these things.
Can two or more operators such as and be combined in a single line of program code?
An expression to whose value an operater is applied a) operand b) variable c) constant d) all of the above
The % symbol has a special use in a printf statement. Explain how would you place this character as part of the output on the screen?
What is a static variable in c?
How can a program be made to print the name of a source file where an error occurs?
a way in which a pointer stores the address of a pointer which stores the value of the target value a) reference b) allocation c) multiple indirection d) none
Explain the use of 'auto' keyword in c programming?
What is an array? What the different types of arrays in c?
Explain how can I remove the trailing spaces from a string?
process by which one bit patten in to another by bit wise operation is? (a) masking, (b) pruning, (c) biting, (d) chopping,
Is it fine to write void main () or main () in c?
Can you explain what keyboard debouncing is, and where and why we us it? please give some examples
What is a function simple definition?
Which is not valid in C a) class aClass{public:int x;}; b) /* A comment */ c) char x=12;