Reset Fault Buffer

#include <iostream>
using namespace std;

int main() {
    int code;
    cin >> code;

    int* pointer = new int;
    *pointer = code;

    cout << *pointer; 

    delete pointer;
    pointer = nullptr;

    if (nullptr == pointer) {
        cout << " " << "OK" << endl;
    } else {
        cout << " " << "NOT_OK" << endl;
    }

    return 0;
}

Solving Approach

 

 

 

 

 

Upvote
Downvote
Loading...

Input

55

Expected Output

55 OK