0

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() { ^

Stats_Lover
  • 396
  • 4
  • 11
  • 1
    Does this answer your question? [Jupyter notebook error for C++ Kernel\[cling\]](https://stackoverflow.com/questions/62751544/jupyter-notebook-error-for-c-kernelcling) – Raz K Mar 02 '21 at 14:13
  • Thanks - it does; I didn't realise the cling angle. – Stats_Lover Mar 02 '21 at 15:00

0 Answers0