array return type

后端 未结 5 793
有刺的猬
有刺的猬 2021-01-29 15:25
#include
#include
#define MAX 30

void push(char );


char stack[MAX];
int tos=0;

int main(){
    char str[]=\"Arijit Saha\";
    char *f         


        
5条回答
  •  渐次进展
    2021-01-29 16:06

    c:14: error: previous implicit declaration of 'rev' was here

    Your error is because you didn't generate a prototype for rev() before you used it in your main(). Either move your function above main or add a prototype.

    c28: warning: function returns address of local variable

    Your warning is because you are trying to return the address of a local variable, you can't do that. Local variables are out of scope when you leave the function, so you need to do something else (such as use a dynamic array via adding malloc()/free() calls)

提交回复
热议问题