1
我需要在遞歸添加樹時爲樹中的某些節點賦予唯一標識符。我寫了這樣的代碼來解決問題:在C中使用靜態變量的唯一標識符
} else if (deapTree[0] == -1){
static int const_idx;
//bla bla bla
root->idx = const_idx;
//bla bla bla
const_idx++;
} else {
這樣工作,我打算?含義const_idx
將從0開始,然後每當到達if
的分支時,它就會增加1.