write a program to reverse a every alternetive words in a
string in a place.
EX: Input is "this is the line of text"
Output should be "shit is eht line fo text"
Please any one tell me code for that.
Answer / Sana Parveen
Here's an example C code for the given problem:
```c
#include <stdio.h>
#include <string.h>
void reverse_word(char *str, int index) {
int len = strlen(str);
if (index >= len / 2) return;
char temp = str[index];
str[index] = str[len - index - 1];
str[len - index - 1] = temp;
reverse_word(str, index + 1);
}
int main() {
char input[] = "this is the line of text";
reverse_word(input, 0);
printf("%s", input);
return 0;
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Is main is user defined function?
write a program that will print %d in the output screen??
What does 3 mean in texting?
When you call malloc() to allocate memory for a local pointer, do you have to explicitly free() it?
AMMONG THE 4 STROAGE CLASSES IN C, WHICH ONE FASTEST?
in linking some of os executables are linking name some of them
Do you know the use of fflush() function?
how can we Declare a variable in c without defining it.
what is the difference between getch() and getche()?
What is the scope of static variable in c?
Explain how do you determine a file’s attributes?
what is diference between return 0 and return NULL??