您的位置:首页 > 编程语言 > Go语言

goto 语句的使用(1)

2010-07-31 09:22 211 查看
// wula.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <malloc.h>

void TestFunction();

int main(int argc, char* argv[])
{
TestFunction();
return 0;
}

void TestFunction()
{
bool bContinue = false;
bool bBreak = false;
char *pBuffer = NULL;

while (1)
{
pBuffer = (char*)malloc(1000);

if (bContinue)
{
goto TestFunction_Continue_Loop;
}

if (bBreak)
{
goto TestFunction_End_Loop;
}

TestFunction_Continue_Loop:
free(pBuffer);
pBuffer = NULL;
}

TestFunction_End_Loop:
if (pBuffer != NULL)
{
free(pBuffer);
pBuffer = NULL;
}

return;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: