I'm trying to understand C++ as I'm new. The below code crashes every time I run it. As far as I know, it should output 0 to 9. Stating that i = num[i] I know is pointless however adding this extra code makes it crash. Why?
    int num[10];
    for(int i = 0; i < 10; i++){
        i = num[i];
        cout << num[i];
    }
Edit - Thanks, guess I didn't see that little error. Seems obvious now...
 
     
    