面试C++试题[9]

[入库:2005年8月19日] [更新:2007年3月24日]

本文简介:选择自 x1001 的 blog

 

#include <iostream>

char *strcpy_x(char *strdest, const char *strsrc)

{

    if((strdest==null) || (strsrc ==null))

       return null;       // 2

    if(strdest==strsrc)//add by xie

       return strdest;  

    char *address = strdest;                                     // 2

    while( (*strdest++ = * strsrc++) != '\0' )              // 2

        ;

   return address ;                                          // 2

}

 

 

class string

       {

         friend std::ostream& operator <<(std::ostream& os, const string& arg);       //add by xie

本文关键:C++,林锐,面试试题
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top