C 反转给定字符串中的每个单词

C 反转给定字符串中的每个单词,c,data-structures,stack,C,Data Structures,Stack,这是一个代码,用于反转字符串中的单词。请帮助我,我没有得到输出 #include <stdio.h> #include<string.h> //an array char arr[1000]; int top=-1; void push(char tm){ if(top<1000){ top++; arr[top]=tm; } } void pop(){ while(top!=-1){ printf("%c",arr[top]);

这是一个代码,用于反转字符串中的单词。请帮助我,我没有得到输出

#include <stdio.h>
#include<string.h>
//an array
char arr[1000];
int top=-1;
void push(char tm){
if(top<1000){
    top++;
    arr[top]=tm;

}

}

void pop(){
while(top!=-1){
    printf("%c",arr[top]);
    top=top-1;
}
printf(".");
}
int main() {
//code
int noc=0;
char fin[10000];
int len;
scanf("%d",&noc);
for(int i=0;i<noc;i++){
scanf("%s",fin);
len=strlen(fin);
for(int i=0;i<len;i++){

    if(fin[i]=="."){ 
        pop();}
    else{
        push(fin[i]);


    }

  }
  printf("\n");
  }
  return 0;
   }
#包括
#包括
//阵列
char-arr[1000];
int top=-1;
无效推送(字符tm){

if(topIf
fin[i]='.
您需要弹出整个堆栈;而不仅仅是一个元素。此外,您正在将字符(
fin[i]
)与字符串(
”)进行比较。您需要解决这个问题。我编写了pop,以便它将清空堆栈,并且如何在不使用==运算符的情况下进行比较?
fin[i]
是字符,将其与字符而不是字符串比较
。这
fin[i]=>“
-->
fin[i]='。
即使我没有得到正确的答案,在
mno
没有
之后,谁能纠正这个问题呢?