如何实现这个功能? [英] How to realize the function ?

查看:76
本文介绍了如何实现这个功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨:全部:


是一些mem cat函数,就像strcat一样?


谢谢

Hi: all:

is some mem cat function with is like "strcat" ?

Thanks

推荐答案

yezi写道:
嗨:全部:

是一些mem cat函数,就像strcat一样。 ?
Hi: all:

is some mem cat function with is like "strcat" ?



否。你可以realloc()一个内存区域,然后memcpy()结束另一个;

或者只是malloc()一个新的并复制两者。显然,你必须知道两个地区的大小。


S.


No. You can realloc() one memory region, then memcpy() the other at the end;
or just malloc() a new one and copy both. You must know the size of both
regions, obviously.

S.


"叶子" <叶***** @ hotmail.com>写道:
"yezi" <ye*****@hotmail.com> wrote:
是一些mem cat函数,就像strcat一样。 ?
is some mem cat function with is like "strcat" ?




不,而且不可能。考虑一下:strcat()如何知道

第一个字符串的结束位置?一个假设的memcat()会如何做同样的事情? (提示:

它不能。)


Richard



No, and there cannot be. Consider: how does strcat() know where the
first string ends? How would a hypothetical memcat() do the same? (Hint:
it cannot.)

Richard




Richard Bos写道:

Richard Bos wrote:
" yezi" <叶***** @ hotmail.com>写道:
"yezi" <ye*****@hotmail.com> wrote:
是一些mem cat函数,就像strcat一样。 ?
is some mem cat function with is like "strcat" ?



不,而且不可能。考虑一下:strcat()如何知道
第一个字符串的结束位置?一个假设的memcat()会如何做同样的事情? (提示:
它不能。)



No, and there cannot be. Consider: how does strcat() know where the
first string ends? How would a hypothetical memcat() do the same? (Hint:
it cannot.)




那么,我们也不应该有memcmp吗? ;)



Then, we shouldn''t have memcmp either ? ;)


这篇关于如何实现这个功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆