什麼更有效?在循環之前或之內聲明數組
聲明數組例如字符緩衝區[4096]之前循環和在每次迭代通過strlcpy清除它的內容或聲明數組在循環內初始「」值?
char buffer[4096] = "";
while(sth)
{
strlcpy(buffer,"",sizeof(buffer));
//some action;
}
VS
while(sth)
{
char buffer[4096] = "";
//some action;
}
*「什麼更有效?」* - 「有效」在哪方面? – 2011-02-24 21:43:46
我不認爲 – 2011-02-24 21:44:16