org-mode/testing/examples/ob-C-test.org

1.7 KiB

a collection of examples for ob-C tests

Simple tests

  std::cout << 42;
  return 0;
  std::cout << q;
  return 0;
  std::cout << p+q;
  return 0;
  std::cout << q << ' ' << std::strlen(q);
  return 0;
  std::cout << N;
  return 0;

Array

  for (int i=1; i<3; i++) {
    std::cout << i << '\n';
  }
  return 0;

Matrix

1 2
3 4
  std::cout << a[0] << a[1] << sizeof(a)/sizeof(*a) << '\n';
  std::cout << a[0] << a[1] << sizeof(a)/sizeof(*a) << '\n';
  std::cout << q[0][0] << ' ' << q[1][0] << '\n'
            << q[0][1] << ' ' << q[1][1] << '\n'; // transpose