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
|
|