重要提示:请勿将账号共享给其他人使用,违者账号将被封禁!
查看《购买须知》>>>
首页 > 考试题库
网友您好,请在下方输入框内输入要搜索的题目:
搜题
如搜索结果不匹配,请联系老师获取答案
扫码添加老师QQ
扫码添加老师微信
题目内容 (请给出正确答案)
[主观题]

New delete 与malloc free 的联系与区别?

答案
查看答案
更多“New delete 与malloc free 的联系与区别?”相关的问题

第1题

C++程序中,使用C函数malloc分配的空间可以使用delete运算符来释放。()
点击查看答案

第2题

定义类模板时要使用关键字 ()。

A.const

B. new

C. delete

D. template

点击查看答案

第3题

用new动态分配的内存必须用delete释放,否则会产生内存泄漏。()
点击查看答案

第4题

找错:#include <string.h>#include <stdio.h>class Base{private:char * name;pu

找错:

#include <string.h>

#include <stdio.h>

class Base

{

private:

char * name;

public:

Base(char * className)

{

name = new char[strlen(className)];

strcpy(name, className);

}

~Base()

{

delete name;

}

char * copyName()

{

char newname [256];

strcpy(newname, name);

return newname;

}

char * getName()

{

return name;

37

}

static void print(Base base)

{

printf("name: %s\n" , base.name);

}

};

class Subclass : public Base

{

public:

Subclass(char * className) : Base(className)

{

}

};

int main()

{

Base * pBase = new Subclass("test");

Base::print(*pBase);

printf("name: %s\n", pBase->getName());

printf("new name: %s\n", pBase->copyName());

return 0;

}

点击查看答案

第5题

程序改错class mml{private:static unsigned int x;public:mml(){ x++; }mml(static unsigned

程序改错

class mml

{

private:

static unsigned int x;

public:

mml(){ x++; }

mml(static unsigned int &) {x++;}

~mml{x--;}

pulic:

virtual mon() {} = 0;

static unsigned int mmc(){return x;}

......

};

class nnl:public mml

{

private:

static unsigned int y;

public:

nnl(){ x++; }

nnl(static unsigned int &) {x++;}

~nnl{x--;}

public:

virtual mon() {};

static unsigned int nnc(){return y;}

......

};

代码片断:

mml* pp = new nnl;

..........

delete pp;

点击查看答案

第6题

下面哪个语句是正确的()。

A. Object o=new Button(" A" );

B. Button b=new 0bject(" B" );

C. Panel p=newFrame() ;

D. Fram

E. f=new Pane10;

点击查看答案

第7题

下列哪个不是创建数组的正确语句?()

A.float f[l0]=new float[6][6];

B. float [fD=new float[6][6];

C. float fD[]=new float][6];

D. float 0[f=new float[6][;

点击查看答案

第8题

New laws have()this kind of assistance virtually impossible.

A.render

B.professional

C.indifferent

D.indebted

E.regarding

F.concernG、fascinateH、pursueI、favorableJ、the case

点击查看答案

第9题

试题7:void Test(void ){char *str = (char *) malloc(100 );strcpy(str, "hello" );free(st

试题7:

void Test(void )

{

char *str = (char *) malloc(100 );

strcpy(str, "hello" );

free(str );

... //省略的其它语句

}

点击查看答案

第10题

试题6:void GetMemory(char **p, int num ){*p = (char *) malloc(num );}void Test(void ){c

试题6:

void GetMemory(char **p, int num )

{

*p = (char *) malloc(num );

}

void Test(void )

{

char *str = NULL;

GetMemory(&str, 100 );

strcpy(str, "hello" );

printf(str );

点击查看答案
下载APP
关注公众号
TOP
重置密码
账号:
旧密码:
新密码:
确认密码:
确认修改
购买搜题卡查看答案 购买前请仔细阅读《购买须知》
请选择支付方式
  • 微信支付
  • 支付宝支付
点击支付即表示同意并接受了《服务协议》《购买须知》
立即支付 系统将自动为您注册账号
已付款,但不能查看答案,请点这里登录即可>>>
请使用微信扫码支付(元)

订单号:

遇到问题请联系在线客服

请不要关闭本页面,支付完成后请点击【支付完成】按钮
遇到问题请联系在线客服
恭喜您,购买搜题卡成功 系统为您生成的账号密码如下:
重要提示:请勿将账号共享给其他人使用,违者账号将被封禁。
发送账号到微信 保存账号查看答案
怕账号密码记不住?建议关注微信公众号绑定微信,开通微信扫码登录功能
请用微信扫码测试
优题宝