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 =
相关文章
相关标签/搜索