code for reverse alternate words from astring

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

Create a simple code fragment that will swap the values of two variables num1 and num2.

800


What is #pragma statements?

583


How to declare a variable?

559


What is hashing in c language?

603


Explain the bubble sort algorithm.

632






Why does not c have an exponentiation operator?

620


What’s a signal? Explain what do I use signals for?

597


What is output redirection?

680


Write a program with dynamically allocation of variable.

597


Can we increase size of array in c?

530


When c language was developed?

630


Why C language is a procedural language?

612


Can we declare function inside main?

558


When should I declare a function?

613


What are structures and unions? State differencves between them.

605