C函数不返回字符串

Fil*_*ira 1 c function strcat

为什么这段代码不返回预期的连接字符串,而是2?

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

const char * meh() {
    char meh1[32] = "This ";
    char meh2[32] = "should work :)";
    return strcat(meh1, meh2);
}

int main() {
    printf(meh());
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

Jam*_*eod 5

因为一旦你离开函数meh,meh1就会超出范围,它在堆栈中占用的区域用于printf中的其他内容.