Thread: c++

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    2

    Question c++

    Why is array of references not allowed??

  2. #2
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912

    Mr. Brainy

    By the way: C++ is not a good title.

    A) try an array of pointers instead. A reference is a specific form of a pointer for a sepcific purpose.

    B) That specific purpose is so you can pass the ADDRESS of an array to a function. you can't pass the array itself. You increment the pointer by one to get the next element. So really, I can't see a point in having an array of references anyway,

    Sean Mackrory
    [email protected]

  3. #3
    Blank
    Join Date
    Aug 2001
    Posts
    1,034
    Array of referances is allowed.

    int& A[4];

  4. #4
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    No they're not, even though it would be possible they were disallowed due to the inconsistancies they'd create (sizeof array elements and you can't have a pointer to a reference).
    zen

Popular pages Recent additions subscribe to a feed