Code that makes errors in the middle

Asked 1 years ago, Updated 1 years ago, 83 views

I'm working on a Python program that interacts with errors in the C++ process The C++ program I made sometimes fails, but sometimes it works fine.

The C++ program needs to be consistently broken It can be compiled and executed Can we make a source that always fails in the middle?

int main() {
    crash(); // a function that always fails
}

c++ crash

2022-09-22 22:34

1 Answers

The easiest way is to write the abort() function.

It's in the C standard library Causes the program to exit abnormally (fatal error/crash).


2022-09-22 22:34

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.