Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
A compound statement consists of zero or more statements enclosed in curly braces ({ }). A compound statement can be used anywhere a statement is expected. Compound statements are commonly called "blocks."
Syntax
{ [ statement-list ] }
Remarks
The following example uses a compound statement as the statement part of the if statement (see The if Statement for details about the syntax):
if( Amount > 100 )
{
cout << "Amount was too large to handle\n";
Alert();
}
else
{
Balance -= Amount;
}
Note
Because a declaration is a statement, a declaration can be one of the statements in the statement-list. As a result, names declared inside a compound statement, but not explicitly declared as static, have local scope and (for objects) lifetime. See Scope for details about treatment of names with local scope.