Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- int f(int x) { return x; }
- int (&g(int x))[3]
- {
- static int a[3];
- for (int n = 0; n < 3; n++) {
- a[n] = x + n;
- }
- return a;
- }
- int (*h(int x))[3]
- {
- static int a[3];
- for (int n = 0; n < 3; n++) {
- a[n] = x + n;
- }
- return &a;
- }
- class Foo
- {
- public:
- int f(int x) { return x; }
- };
- int main()
- {
- {
- typedef int t0;
- t0 n = 0;
- }
- {
- typedef int* t1;
- int n = 0;
- t1 p = &n;
- }
- {
- typedef int t2(int);
- t2 *fp = f;
- fp(365);
- }
- {
- typedef (t3)(int);
- t3 *fp = f;
- fp(365);
- }
- {
- typedef int(*t4)(int);
- t4 fp = f;
- fp(365);
- }
- {
- typedef int(&t5)(int);
- t5 fr = *f;
- fr(365);
- }
- {
- typedef int t6[3];
- t6 a = {1, 2, 3};
- for (auto n : a) {
- std::cout << n << std::endl;
- }
- }
- {
- typedef int(t7)[3];
- t7 a = {1, 2, 3};
- for (auto n : a) {
- std::cout << n << std::endl;
- }
- }
- {
- typedef int(*t8)[3];
- int i[] = {1, 2, 3};
- t8 a = &i;
- for (auto n : *a) {
- std::cout << n << std::endl;
- }
- }
- {
- typedef int(&t9)[3];
- int i[] = {1, 2, 3};
- t9 a = i;
- for (auto n : a) {
- std::cout << n << std::endl;
- }
- }
- {
- typedef int(&(*t10)(int))[3];
- t10 fp = g;
- int (&a)[3] = g(10);
- for (auto n : a) {
- std::cout << n << std::endl;
- }
- }
- {
- typedef int(*(&t11)(int))[3];
- t11 fr = *h;
- int (*a)[3] = h(10);
- for (auto n : *a) {
- std::cout << n << std::endl;
- }
- }
- {
- typedef int(Foo::*t12)(int);
- t12 fp = &Foo::f;
- Foo foo;
- (foo.*fp)(365);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement