24. Reset Fault Buffer

Your firmware stores a fault code in a dynamically allocated buffer.
After handling the fault, the buffer must be deleted and the pointer reset to nullptr to avoid unsafe reuse.

Steps required:

  1. Dynamically allocate an integer pointer using new.
  2. Store the input fault code in it.
  3. Print the stored code.
  4. Delete the allocated memory using delete.
  5. Set the pointer to nullptr.
  6. Print:
    • "OK" if the pointer is nullptr
    • "NOT_OK" otherwise

 

Output format:

<faultCode> OK

 

Example 

Input:

55

Output:

55 OK

 

Constraints:

  • You must delete the allocated memory and reset the pointer to nullptr.
  • Do not print the pointer value directly.

 

 

Loading...

Input

55

Expected Output

55 OK