When running this code on Code Blocks breakpoint 2 occurs before breakpoint 1.
Breakpoint 1 eventually occurs followed by breakpoint 1 but just wondering why it occurs in the order 212
#include <bits/stdc++.h>
using namespace std;
void solve() {
int n; cin >> n; // Breakpoint 1
int monks[n];
for(int i=0; i<n; i++){
int a; cin >> a;
monks[i] = a;
}
sort(monks, monks+n);
int total = 0; // Breakpoint 2
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
freopen("hirein.txt", "r", stdin);
freopen("hireout.txt", "w", stdout);
solve();
return 0;
}
totalto 0 has no observable effect in the shown code, in fact it does nothing whatsoever, and since doing nothing whatsoever can be done any time, the compiler chose to spew out the code that does nothing before the rest of the code. That's it.