C語言中do...while(0)的妙用-避免goto

使用goto的優雅並避免結構的混亂 將要跳轉到的語句用do{…}while(0) 包起來便可。 referencehtml #defien N 10 bool Execute() { // 分配資源 int *p = (int *)malloc(N * sizeof(int)); bool bOk = true; // 執行並進行錯誤處理 bOk =
相關文章
相關標籤/搜索