repl.it
C++

binary tree implemented by array

fork
loading
Files
  • main.cpp
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <iostream>
using namespace std;

void y(int * a, int b)
{
    cout << "Function y: " << a << endl;
}

int * i(int * a, int& b)
{
    int c[1] = { 1 };
    int * n = c;
    b++;
    return n;
}

int main()
{
    int * a = NULL;
    int b;
    b = 1;
    a = i(a, b);
    y(a, b);
    cout << "After function: " << a << " " << b;
    return 0;
}
?