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
What is meant by inheritance?
What is exit() function?
If I have a char * variable pointing to the name of a function ..
difference between native and cross compilers
typedef struct{ char *; nodeptr next; } * nodeptr ; What does nodeptr stand for?
When can you use a pointer with a function?
What is the best style for code layout in c?
what is the syallabus of computer science students in group- 1?
how to construct a simulator keeping the logical boolean gates in c
What is a null string in c?
Differentiate between the expression “++a” and “a++”?
What is a constant?
What is the use of structure padding in c?
What is structure padding in c?
the factorial of non-negative integer n is written n! and is defined as follows: n!=n*(n-1)*(n-2)........1(for values of n greater than or equal to 1 and n!=1(for n=0) Perform the following 1.write a c program that reads a non-negative integer and computes and prints its factorial. 2. write a C program that estimates the value of the mathematical constant e by using the formula: e=1+1/!+1/2!+1/3!+.... 3. write a c program the computes the value ex by using the formula ex=1+x/1!+xsquare/2!+xcube/3!+....