且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在c中返回一个数组

更新时间:2022-12-10 23:41:10

您可以通过将数组包装在结构中来返回:

You can return an array by wrapping it in a struct:

struct S {
   char a[100];
};

struct S f() {
    struct S s;
    strcpy( s.a, "foobar" );
    return s;
}