News:

This week IPhone 15 Pro winner is karn
You can be too a winner! Become the top poster of the week and win valuable prizes.  More details are You are not allowed to view links. Register or Login 

Main Menu

c++ array tips - References and arrays

Started by ben2ong2, October 06, 2006, 06:00:47 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ben2ong2

PROBLEM: You are not allowed to view links. Register or Login (Andrew J. Jackson)

I'm inquiring on how to declare a reference to an array of integers


RESPONS: Efim Birger (efim@microware.com)

try this:

typedef int *intp;
   int arr[10];
   intp& aaa = arr;


RESPONSE: You are not allowed to view links. Register or Login (Fergus Henderson), 11 Aug 94

This code is illegal.  `aaa' is a (non-const) reference to a pointer to int.
`arr' is an array of int, which will be converted to a pointer to int.
The result of that conversion is a temporary.
You are initializing a non-const reference with a temporary, which is illegal.


RESPONSE: You are not allowed to view links. Register or Login (Bernd Eggink)

There is no such thing as a reference to an array.


RESPONSE: You are not allowed to view links. Register or Login (Fergus Henderson)

There most certainly is.
(An array of references is illegal, but a reference to an array is quite OK.)



You are not allowed to view links. Register or Login
You are not allowed to view links. Register or Login