#include <iostream>
using namespace std;

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++ 用引用的方式向函数传递数组

相关文章:

  • 2019-11-05
  • 2021-12-23
  • 2021-04-14
  • 2021-06-27
  • 2021-07-17
  • 2022-12-23
  • 2021-11-02
  • 2022-01-08
猜你喜欢
  • 2022-12-23
  • 2021-12-12
  • 2022-02-07
  • 2022-01-30
  • 2022-12-23
  • 2022-02-07
  • 2022-12-23
相关资源
相似解决方案