#include<stdio.h>
#include<string.h>
#define MAX 30
void push(char );
char stack[MAX];
int tos=0;
int main(){
char str[]="Arijit Saha";
char *final;
final=(char *)rev(str);
printf("%s",final);
rev(str);
getch();
return 1;
}
char* rev(char s[]){
int i;
for(i=0;i<strlen(s);i++)
push(s[i]);
char reverse[strlen(s)];
for(i=0;i<strlen(s);i++)
reverse[i]=pop();
return reverse;
}
void push(char c){
stack[tos]=c;
tos++;
}
int pop(){
tos--;
return stack[tos+1];
}
这些是错误消息..
Compiler: Default compiler
Executing gcc.exe...
gcc.exe "C:\TC\BIN\stringrevusingstack.c" -o "C:\TC\BIN\stringrevusingstack.exe" -g3 -I"C:\TC\INCLUDE" -I"C:\Dev-Cpp\include" -I"C:\Program Files\ImageMagick-6.7.4-Q16\include" -L"C:\Dev-Cpp\lib" -L"C:\TC\LIB" -L"C:\Program Files\ImageMagick-6.7.4-Q16\lib" -g3
C:\TC\BIN\stringrevusingstack.c:20: error: conflicting types for 'rev'
C:\TC\BIN\stringrevusingstack.c:14: error: previous implicit declaration of 'rev' was here
C:\TC\BIN\stringrevusingstack.c: In function `rev':
C:\TC\BIN\stringrevusingstack.c:28: warning: function returns address of local variable
Execution terminated
怎么了?