C Label (computer science)
function labels consist of identifier, followed colon. each such label points statement in function , identifier must unique within function. other functions may use same name label. label identifiers occupy own namespace - 1 can have variables , functions same name label.
here error label. statement goto can used jump labeled statement in code. after goto, program execution continues statement after label.
switch labels
two types of labels can put in switch statement. case label consists of keyword case, followed expression evaluates integer constant. default label consists of keyword default. case labels used associate integer value statement in code. when switch statement reached, program execution continues statement after case label value matches value in parentheses of switch. if there no such case label, there default label, program execution continues statement after default label. if there no default label, program execution continues after switch.
within single switch statement, integer constant associated each case label must unique. there may or may not default statement. there no restriction on order of labels within switch. requirement case labels values evaluate integer constants gives compiler more room optimizations.
Comments
Post a Comment