天天看点

C++ 用引用的方式向函数传递数组

#include

int a[10] = { 10,20 };

void GetCharArr(char (&ac)[20])

{    

    sprintf_s(ac, "ABABXX%d", a[0]);

}

int main()

{

    char str1[20];

    GetCharArr(str1);

    printf("当前的字符串是:%s", str1);

    system("PAUSE");

    return 0;

C++ 用引用的方式向函数传递数组

继续阅读