[C库函数]strcat实现

来源:岁月联盟 编辑:exp 时间:2012-09-19
[cpp] 
#include <iostream> 
#include <assert.h> 
using namespace std; 
 
char *strcat_bxy(char *dst, const char *src) 

    assert(dst != NULL && src != NULL); 
    char *tmp = dst; 
    while(*dst != NULL) 
    { 
        dst++; 
    } 
    while(*dst++ = *src++); 
    return tmp; 

 
void main() 

    char a[100] = "bxy"; 
    char *b = "123"; 
    strcat_bxy(a,b); 
    cout << a <<endl; 

下一篇:C语言要点

图片内容