What is the difference between (string &StrArray[5]) and (string (&StrArray)[5])? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is the difference between (string &StrArray[5]) and (string (&StrArray)[5])?

I want to know what is the difference of these inside a function's parameters. I know that the first one declares an array of references to string and the second declares a reference to an string array. I already know the used of the second one, but what is the use of the first one. How can I use it and what should I pass to a function with this parameter. Any explains would be appreciated. Thanks.

27th Mar 2020, 8:42 PM
D3F4U1T
1 Answer
+ 1
You can't define array of references. It is prohibited. According to C++ standard there shall be no arrays of references.
27th Mar 2020, 9:13 PM
andriy kan
andriy kan - avatar