AceTheInterview
Jobs in Pune | Work better in teams | Socialize with friends | Submit Q&A | Tell a friend
Search site for 

Top 100 Interview Questions & Answers in a convenient and easy to read book!

“I bought this guide a few days ago to prepare for my interview with Oracle. Many of the questions they asked me were from this guide. I found this book absolutely great!”

– Ravi, California

Read more comments...

Interview Questions And Answers RSS Feed

Answers »

  1. Submitted By: e — October 27, 2006
    -17 votes
      + -

    arrays are already passed by refrence not by value

  2. Submitted By: afshin — October 27, 2006
    +12 votes
      + -

    Because reference variables must be initialized in C++, but there is no way to initialize arrays!

  3. Submitted By: Neetu — October 29, 2006
    -36 votes
      + -

    May be this is the reason
    Array of reference is not possible Bcoz array of pointers is not possible.
    array of pointers is not possible bcoz reference may refer to any other variable

  4. Submitted By: roger — October 29, 2006
    -3 votes
      + -

    array is to store variable, but reference is not a type of variable but only the address of variable.
    You can’t assign value to a reference like:
    int a = 8, b= 9; & a = &b ;
    nor
    &a= 0X0000….;
    nor

    int &A [2]= {&a,&b};

    Instead, you can use pointer:

    int * A[2] = {&a,&b};// pointer is a Variable!

  5. Submitted By: Muthukumar — November 14, 2006
    +12 votes
      + -

    1) The reference must be initialized by the time it is declared e.g. int &r = a;
    2) But it is also possible to have something like
    int p[5] = {2,3,4} which would mean that the last two elements be initialized to a default ‘0′.

    Going by the argument #2), we would end up something like int&r[5] = {a, b, c} assuming a,b,c are integers — which would mean that the last two references in the array not to refer to any valid memory location that is against argument#1.

  6. Submitted By: Pranav — December 5, 2006
    -2 votes
      + -

    array of reference is not possible because we cant change the address of reference until u initialize it for the next data type..that means we cant access elements as in normal aaray…

  7. Submitted By: CORRECT ONE — December 6, 2006
    +1 votes
      + -

    an array has contiguous elements.

    but if you create an array of references then the values
    you initialise may not have contiguous values in memory.
    Hence C doesnot hv array of refernces.

    But it is theoraticaly possible to have that facility in the language definition.

  8. Submitted By: Chini — January 30, 2007
    +2 votes
      + -

    Can we treat an address as an value, i mean, consider 000f(example) and storing this value in an array element, after retrievin we can treat it as an address.

  9. Submitted By: Nasimudeen.A — March 30, 2007
    +2 votes
      + -

    Reference variable must be initializd when it is created. This not possible with array of references.
    reference is actually an alias name given to an existing memory location.
    eg:
    int i=10;
    int &j=i;
    printf(”%u %u”,&i,&j);
    This will print the same address for i & j.

  10. Submitted By: Oleksandr — October 23, 2007
    -1 votes
      + -

    reference is only compiling-time alias of some memory address. It is not a pointer. Only the second name of some variable.

    Defining the reference does not increase memory usage.

    When you create an array, you create an array of some data, that has specific size and is contiguous in memory with sequenced memory addressed.

    Pointer is a variable, that takes some memory to store data address, reference is only alias, used during compile time.

  11. Submitted By: ramow — November 12, 2007
    +0 votes
      + -

    I am just wondering why can’t we have:

    int&r[5] = {a, b, c, d, e}

    where a, b, c, d, e are integers.
    Isn’t this considered as an array of references?

  12. Submitted By: niskam — July 3, 2008
    not yet rated
      + -

    no, a reference is not an object,,,,so we cant find the address…of reference
    we can do …references to an array…
    int z[]={1,2,3,4,5};
    int (&s)[5]=z;

  13. Leave an Answer/Comment

    To prove you're a person (not a spam script), type the security text shown in the picture. Click here to regenerate some new text.
    Click to hear an audio file of the anti-spam word

Our Sponsors
Our Sponsors
Contact Us | FAQ | Sitemap | Terms of Use | Privacy Policy | Tell a Friend

Copyright © 1999-2006 Jeeve Technologies LLC. All rights reserved.