小编use*_*230的帖子

C错误我之前没遇到过

shell_command(char gcommand[100]) {
    FILE *pipe = popen("ls", "r");
    char output[100];

    if ( pipe ) {
        fgets(output, sizeof output, pipe);
        pclose(pipe);
    }
    return output;
}
Run Code Online (Sandbox Code Playgroud)

结果是

program.c:在函数'shell_command'中:
program.c:42:warning:return从指针生成整数而没有
强制转换program.c:42:warning:function返回局部变量的地址

我两天都用Google搜索,但没有成功

c variables pointers integer

1
推荐指数
1
解决办法
86
查看次数

标签 统计

c ×1

integer ×1

pointers ×1

variables ×1