2011年10月5日

摘要: 原题地址http://poj.org/problem?id=3852String LDTime Limit:1000MSMemory Limit:65536KDescriptionStringld (left delete) is a function that gets a string and deletes its leftmost character (for instance Stringld(“acm”) returns “cm”).You are given a list of distinct words, and at each step, we apply stringld 阅读全文
posted @ 2011-10-05 23:47 yming0221 阅读(209) 评论(0) 推荐(0)
摘要: 相同点:都可用于申请动态内存和释放内存不同点:(1)操作对象有所不同。malloc与free是C++/C 语言的标准库函数,new/delete 是C++的运算符。对于非内部数据类的对象而言,光用maloc/free 无法满足动态对象的要求。对象在创建的同时要自动执行构造函数, 对象消亡之前要自动执行析构函数。由于malloc/free 是库函数而不是运算符,不在编译器控制权限之内,不能够把执行构造函数和析构函数的任务强加malloc/free。(2)用法上也有所不同。函数malloc 的原型如下:void * malloc(size_t size);用malloc 申请一块长度为length 阅读全文
posted @ 2011-10-05 13:13 yming0221 阅读(112) 评论(0) 推荐(0)

导航