回复:C++ 高手请进

Q2: void getbuf(char *&arrayInOut)

Q4: getbuf() will compile successfully, and can execute but execution result is undefined.

Q6: not good practice. but not because it won't execute. see "不是高手"

Q7: to compile, define: "char* anotherfunction(char*)" before line 212

Q8: char *a, *b;

char* getbuf(char **buf)
a = getbuf(&b);

or

void getbuf(char **buf1, char **buf2) // better practice
getbuf(&a, &b);

// no C++ syntax means don't pass-by-reference such as my Q2 answer

Q9: see "zy001"

Q10: besides what u said,

system call is system dependent, not portable, not replaceable, running in OS kernel

library function is more portable, replaceable, running in user process

if library function uses system call, it's slower but give a more friendly interface. if library function not uses system call, e.g. isdigit(), it's very fast. system call requires context switch from user process to the kernel which has a overhead.

------------------------------------
IMHO, these questions are not best designed, and you often miss the point what they are asking. when you have questions, you can always google it (such as Q10) and copy/paste/write few lines code and actually compile/run/test them. that's what I often do when I prepare for coding questions.

good luck!

所有跟帖: 

这位是高手, 不得不服 -不是高手...- 给 不是高手... 发送悄悄话 (190 bytes) () 09/09/2005 postreply 13:42:50

请您先登陆,再发跟帖!