小编des*_*les的帖子

最后一次删除错误[]

我无法理解为什么会有错误delete[] *iopszString;,你能帮我解决吗?

尝试输入: 1 3 aaa

如果我省略了最后一次删除[]它一切正常但它没有意义,因为为了交换指针我需要删除前一点. 代码

// Notepad.cpp

#include <iostream>
#include <fstream>
#include <string>

using namespace std;

// Method definition
void addText(char** iopszString);

void main()
{

    // Const definition
    int const ADD    = 1;
    int const UPDATE = 2;
    int const DELETE = 3;
    int const SAVE   = 4;
    int const EXIT   = 5;

    // Variable definition
    int nUserCode;

    // Code section

    // Gets the user code
    cout << "Enter the code: " << endl;
    cin …
Run Code Online (Sandbox Code Playgroud)

c++ pointers delete-operator

1
推荐指数
1
解决办法
77
查看次数

标签 统计

c++ ×1

delete-operator ×1

pointers ×1