This seems like a perfectly valid C++ code to me which compiles alright in VSCode but refuses to work in Jupyter notebook. Any pointers to get around this would be appreciated. Thanks
#include <iostream>
using namespace std;
int main() {
int arr[] = {1, 2, 3, 4, 5, 6};
std::cout << (1+3)[arr];
std::cout << "\n";
std::cout << (1 + 3)[arr] - arr[0] + (arr + 1)[2];
std::cout << "\n";
}
The error I get is the following
input_line_23:3:12: error: function definition is not allowed here int main() { ^