天天看點

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++ 用引用的方式向函數傳遞數組

繼續閱讀