c++ sigabrt

#include <iostream>
using namespace std;

int main() {
    int* ptr = nullptr;
    *ptr = 10;

    return 0;
}
  1. Issue: Segmentation fault (SIGSEGV) or a similar error
  2. Explanation: The code declares a pointer ptr and initializes it with a null pointer (nullptr).
  3. Problem: Dereferencing the null pointer by trying to assign a value to the memory location it points to (*ptr = 10;).
  4. Outcome: This results in undefined behavior and often causes a segmentation fault as it's illegal to access or modify memory using a null pointer.