Tuesday, January 3, 2012

Can I next switch control structures?

Can I next switch control structures?

Yes, a nested switch control structure could take the following form:

switch (outer_expression)
{
case constant_outer1:
switch (inner_expression)
{
case constant_inner1:
statement inner_1a
statement inner_1b
..
..

case constant_inner2:
statement inner_2a
..
..
}
case constant_outer2:
statement outer_2a
statement outer_2b
..
..
case constant_outer3:
statement outer_3a
statement outer_3b
..
..
}

No comments:

Post a Comment