code for reverse alternate words from astring



code for reverse alternate words from astring..

Answer / rohit

#include<stdio.h>
#include<conio.h>
int main()
{
char string[30]="hoow are you?";
static char stoken[15][10];
int i,j,k;
j=0;k=0;

for(i=0;string[i]!='\0';i++,k++)
{
if(string[i]==' ')
{
j++;
k=0;
}
else
{
stoken[j][k]=string[i];
}
}
for(i=j;i>=0;i--)
printf("%s\n",stoken[i]);
getch();


return 1;
}

Is This Answer Correct ?    6 Yes 23 No

Post New Answer

More C Interview Questions

write a program to check whether a number is Peterson or not.

4 Answers  


difference between spiral and waterfall model

1 Answers  


why program counter is 16 bit?

3 Answers  


a function gets called when the function name is followed by a a) semicolon (;) b) period(.) c) ! d) none of the above

0 Answers  


How can this be legal c?

0 Answers  


Write a program in C to print the alphabets in order as on a mobile phone.i.e:When 2 is pressed once 'a' prints and if it is pressed two times 'b' prints and so on.we have to print all the alphabets as on mobile phone like this.

1 Answers   Wipro,


Write the following function in C. stripos — Find position of first occurrence of a case- insensitive string int stripos ( char* haystack, char* needle, int offset ) Returns the numeric position of the first occurrence of needle in the haystack string. Note that the needle may be a string of one or more characters. If needle is not found, stripos() will return - 1. The function should not make use of any C library function calls.

3 Answers   Google, Infosys, JTL, OpenFeel,


A global variable when referred to in another file is declared as this a) local variable b) external variable c) constant d) pointers

0 Answers  


What is Bitwise Operator and how it works?

1 Answers  


Is c pass by value or reference?

0 Answers  


write a program fibonacci series and palindrome program in c

0 Answers   Aditi Placement Service,


main() { int *ptr=(int*)malloc(sizeof(int)); *ptr=4; printf("%d",(*ptr)+++*ptr++); }

2 Answers  


Categories