Exemple #1
0
int main()
{
  printf("\nSTACK FOO:\n\n");

  struct Foo ex;
  printFoo(ex);

  ex.a = 0;
  ex.b = 15;
  ex.c = -8;
  ex.d = 7;
  printFoo(ex);

  ex.a = -1;
  ex.a = 16;
  ex.c = -9;
  ex.d = 8;
  printFoo(ex);

  printf("\nHEAP FOO:\n\n");

  struct Foo *hxp = malloc(sizeof(struct Foo));
  printFoo((*hxp));

  (*hxp).a = 0;
  (*hxp).b = 15;
  (*hxp).c = -8;
  (*hxp).d = 7;
  printFoo((*hxp));

  hxp->a = -1;
  hxp->b = 16;
  hxp->c = -9;
  hxp->d = 8;
  printFoo((*hxp));

  free(hxp);

  return 0;
}
Exemple #2
0
int main()
{
  printf("\nSTACK FOO:\n\n");

  Foo ex;
  printFoo(ex);

  ex.a = 0;
  ex.b = 15;
  ex.c = -8;
  ex.d = 7;
  printFoo(ex);

  ex.a = -1;
  ex.a = 16;
  ex.c = -9;
  ex.d = 8;
  printFoo(ex);

  printf("\nHEAP FOO:\n\n");

  Foo *hxp = new Foo;
  printFoo((*hxp));

  (*hxp).a = 0;
  (*hxp).b = 15;
  (*hxp).c = -8;
  (*hxp).d = 7;
  printFoo((*hxp));

  hxp->a = -1;
  hxp->b = 16;
  hxp->c = -9;
  hxp->d = 8;
  printFoo((*hxp));

  delete hxp;

  return 0;
}
int main()
{
  auto t = new test("bar");
  t->printFoo();
}
void b(){
	for(int i=0; i<100000000; i++) {
		printFoo();
		printBar();
	}
}