我有一個作業問題來完成此方法。我真的不知道該怎麼做。鑑於此psuedocode可以有人幫我寫這種方法?函數將用戶輸入並將其添加到數組
/*
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;
}
目前尚不清楚新尺寸是什麼?也許這需要作爲函數的參數來傳遞?什麼是新的字符被添加到新的陣列? – 2012-03-14 17:21:24
你的函數簽名是否必須是char * add(char * array,int num)'? – 2012-03-14 18:19:39
是的,它必須具有該簽名 – anthony 2012-03-14 19:42:28