由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - 3 c++ challenge-and-grill questions
相关主题
问个简单的memory allocation 的问题。请问strcpy()和memcpy()的写法问题  (转载)
[合集] 谁给个stack-based allocation 的C++的例子?一道笔试题
问一个private destructor的问题What is wrong with the constructor calling?
请问C++ exception后如何清理function stack上的内存资源?array allocation in c
new一定要和delete配对吗?Dynamic buffer management question
static variable存在heap还是stack?关于thread的stack
关于内存泄漏内存分配问题
why do we still use dynamic allocation?a small question about c++ memory allocation
相关话题的讨论汇总
话题: dest话题: stack话题: clause话题: str1话题: c++
进入Programming版参与讨论
1 (共1页)
l********y
发帖数: 1327
1
1. how to copy a string without using strcpy function in only one clause?
for
example
char * str1 = "welcome";//this is source to be copied
//want to copy str1 to dest using only one clause!
......char * dest ......//how to write this clause?
2. c++ class default functions?
i think there are 4, cons, destructor,copy cons, assignment operator.
but someone says there are more, like & , someone is a guy senior tech title
from IB. is this true? really confused.
3. how to dynamically allocate memory on stack?
someone said stack memory can also be dynamically allocated. yes stack the
stack memory,not heap.
is this possible? and how?
l*********s
发帖数: 5409
2
2. I think he is ok to say so "default function", as operators can be
overloaded
3. alloca
c**b
发帖数: 2999
3
dest=str1, shallow copy
& is pass by reference.
alloca

title

【在 l********y 的大作中提到】
: 1. how to copy a string without using strcpy function in only one clause?
: for
: example
: char * str1 = "welcome";//this is source to be copied
: //want to copy str1 to dest using only one clause!
: ......char * dest ......//how to write this clause?
: 2. c++ class default functions?
: i think there are 4, cons, destructor,copy cons, assignment operator.
: but someone says there are more, like & , someone is a guy senior tech title
: from IB. is this true? really confused.

z****e
发帖数: 2024
4
1. for(int i=0; (dest[i]=source[i])!='\0'; ++i);

title

【在 l********y 的大作中提到】
: 1. how to copy a string without using strcpy function in only one clause?
: for
: example
: char * str1 = "welcome";//this is source to be copied
: //want to copy str1 to dest using only one clause!
: ......char * dest ......//how to write this clause?
: 2. c++ class default functions?
: i think there are 4, cons, destructor,copy cons, assignment operator.
: but someone says there are more, like & , someone is a guy senior tech title
: from IB. is this true? really confused.

c**b
发帖数: 2999
5
这个dest指针需要初始化吗?

【在 z****e 的大作中提到】
: 1. for(int i=0; (dest[i]=source[i])!='\0'; ++i);
:
: title

1 (共1页)
进入Programming版参与讨论
相关主题
a small question about c++ memory allocationnew一定要和delete配对吗?
a c++ question.static variable存在heap还是stack?
几个问题关于内存泄漏
[合集] c++ delete问题why do we still use dynamic allocation?
问个简单的memory allocation 的问题。请问strcpy()和memcpy()的写法问题  (转载)
[合集] 谁给个stack-based allocation 的C++的例子?一道笔试题
问一个private destructor的问题What is wrong with the constructor calling?
请问C++ exception后如何清理function stack上的内存资源?array allocation in c
相关话题的讨论汇总
话题: dest话题: stack话题: clause话题: str1话题: c++