InterviewGuide icon indicating copy to clipboard operation
InterviewGuide copied to clipboard

C++ 第106题

Open stone322 opened this issue 2 years ago • 0 comments

原文:如果数据对象是数组,则只能使用指针 反例:

template<typename T, int N>
void func(T (&a)[N])
{
    a[0] = 2;
}

int main()
{
    int a[] = { 1, 2, 3 };
    func(a);
    cout << a[0] << endl;
    return 0;
}

stone322 avatar Mar 13 '22 01:03 stone322