#Segfault in VSCode but compiles and runs on online compiler

5 messages · Page 1 of 1 (latest)

minor hollow
#
#include <iostream>
using namespace std;

void stupid_sort(int array[], int length) {
    int last_element = array[length-1];
    cout << last_element << "\n";
}

int main() {
    int array[] = {1,2,4,5,6,3};
    int length = sizeof(array) / sizeof(int);
    cout<<length;
    stupid_sort(array, length); 
    return 0;
}

proven kayakBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

#

Thank you and let us know if you have any more questions!

This thread is now set to auto-hide after an hour of inactivity

#

true grove