【发布时间】:2012-03-14 17:19:12
【问题描述】:
我有一个作业问题来完成这个方法。我真的不知道该怎么办。鉴于这个伪代码有人可以帮我写这个方法吗?
/*
make a new array of the old size plus the new size
copy from the old to the new
add the new characters
don't forget to clean up the old array (free it)
before you leave this function
*/
char * add(char * array, int num)
{
return array;
}
【问题讨论】:
-
不清楚新尺寸是多少?也许这也需要作为函数参数传递?要添加到新数组中的新字符是什么?
-
你的函数签名必须是
char * add(char * array, int num)吗? -
是的,它必须有那个签名