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 )
Answers were Sorted based on User's Feedback
Answer / vaibhav srivastava
#include<stdio.h>
int main()
{
char str[50];
int i,j,k;
printf("\nEnter the string\t");
fflush(stdin);
gets(str);
puts(str);
for (i=0; str[i]!='\0';i++);
for ( k=i; k>0; k--)
{ if ( str[k]==' ' || k==i)
{ for( j=k-1; (str[j]!=' ') && (j!=-1) ;j--);
{
while ( ++j!=k)
{printf("%c", str[j]);}
printf(" ");
}
}
}
printf("\n");
}
| Is This Answer Correct ? | 22 Yes | 3 No |
Answer / 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 |
What's the difference between struct x1 { ... }; and typedef struct { ... } x2; ?
What is the full form of getch?
how many key words availabel in c a) 28 b) 31 c) 32
please give me answer with details #include<stdio.h> main() { int i=1; i=(++i)*(++i)*(++i); printf("%d",i); getch(); }
HOW TO ANSWER IF ASKED " WHAT KIND OF A PERSON ARE YOU?" I NEED AN ANSWER THAT IMPRESS THE INTERVIEWER
What are reserved words with a programming language?
write a programming in c language, 1 3 5 7 9 11
Explain what are the advantages and disadvantages of a heap?
Explain what are its uses in c programming?
Explain what is the difference between functions getch() and getche()?
When the macros gets expanded?
Give a method to count the number of ones in a 32 bit number?