In the following code:
class Array {
   public:
      int& operator[] (unsigned i) { if (i > 99) error(); return data[i]; }
   private:
      int data[100];
};
int main()
{
   Array a;
   a[10] = 42;
   a[12] += a[13];
   ...
}
(Correct me if I'm wrong) The variable a of type Array is on the stack since new was not used to allocate it. The Array class has int data[100], and the operator overload returns reference to particular index in data.
Referring question.
My question is whether int data[100] is on the stack or heap ? I think it shouldn't be the stack, otherwise how can a reference return like the one above still work.
Thanks.
 
     
     
     
     
     
    