TITLE: arrays and references (Newsgroups: comp.lang.c++.moderated) PROBLEM: pronet03@indirect.com (Paul Carlton) I have been working with C++ for quite sometime and I'm embarrassed to admit this, but someone asked me the other day if it makes sense to have an array of references in those cases where you'd normally have an array of pointers. ... My best educated guess and from experience is that there is no such thing as trying to even declare an array of references. RESPONSE: clamage@Eng.Sun.COM (Steve Clamage), 26 May 96 That is correct. The language definition specifically prohibits creating a pointer to a reference or an array of references. (Technically, a reference is not an object.) The problem with pointers to and arrays of references is there is no syntax to get the address of the reference itself. If you write int x; int &ir = x; then &ir gives you the address of x, not the address of ir. If we allowed arrays of references, the expected properties of arrays would not hold. Example, where T is some type: T& tr[4]; T to[4]; Whether you access tr[2] or to[2], you get a T object; you never get a T& object. The expression &to[2] - &to[1] must have the value of sizeof(T). But consider &tr[2] - &tr[1] The result should be be the size of a T&, but it isn't. It probably is not even a valid expression. You can subtract addresses only if the objects are in the same array, and the actual objects could be anywhere. (Think of an array of pointers to arbitrary objects.) Instead of trying to invent special rules, C++ just says that a reference is not an object, you can't take its address, you can't create a pointer to one, and you can't make an array of references.