Public feed #892743

Mine

public text v1 · immutable
Raw Edit
·published 2008-02-05 18:00 UTC
rendered paste body
#include <iostream>

class Foo
{
  int **array;
  //int *array[]; // kompiliert nicht!

public:
  Foo(int i)
  {
    int *temp[i];
    array = temp;

    int bar = 7;
    array[0] = &bar;
  }

  int* m()
  {
    return array[0];
  }
};

int main()
{
  Foo foo(10);

  std::cout << "before segfault" << std::endl;
  std::cout << *(foo.m()) << " == 7 ?" << std::endl;
}