how to perform reversing a sentence Word by Word in C?

后端 未结 12 1460
伪装坚强ぢ
伪装坚强ぢ 2021-01-25 04:49
#include 

int main(void)
{
  int i,j;
  int wordstart = -1;
  int wordend = -1;
  char words[]= \"this is a test\";
  char temp;

  // Reverse each word
         


        
12条回答
  •  Happy的楠姐
    2021-01-25 05:12

    Use a main for loop to traverse till the end of the sentence: Copy the letters in a string until you find a space. now call add@beginning function and in that function add the string each time you pass a string to the linked list. print the contents of the linked list with a space inbetween to get the expected output

提交回复
热议问题