I have the following code in which I accidently did left shifting instead of right shifting of the variable p.  

However, when I ran the code, the pointer `root` was being reset to null (for input 2 and many others).  

Shouldn't there be a segmentation fault, because of the array bits?  

Could someone please explain this behaviour?

Thanks in advance.

```cpp
#include <bits/stdc++.h>
using namespace std;

typedef struct $ {
    struct $* left;
    struct $* right;

    $(){
        left = NULL;
        right = NULL;
    }
} vertex;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    long long p;

    cin >> p;
    bool bits[30];

    vertex* root = new vertex();
    cout << "root: " << root << endl;

    int j = 0;

    while(p){
        bits[29 - j] = p&1;
        j++;
        p <<= 1;
    }

    cout << "root: " << root << endl;

    return 0;
}

```