void mycopy(int* dst, int* src, int* src_end)
{
  if(dst==src) return;
  int n = src_end - src;
  if(dst>src)
    for(int i=n-1; i>=0; i--) dst[i] = src[i];
  else
    for(int i=0; i<n; i++) dst[i] = src[i];
}
void show(int* a, const int n)
{
  for(int i=0; i<n; i++) cout << a[i] << " ";
  cout << endl;
}
int main()
{
    int a[] = {1,2,3,4,5};
    int b[] = {4,5,6,7,8};
      mycopy(a+3,b,a+4);
      show(b,5);

      return 0;
}
这当中的int n ;n代表什么意思


相关课程:C++特训班>第一阶段:基础篇>基础篇>数组元素搬运

©2014-2023 百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园
网站维护:百战汇智(北京)科技有限公司
京公网安备 11011402011233号    京ICP备13018289号-12    营业执照    经营许可证:京B2-20212637