[Prev][Next][Index]
default option in a switch statement.
- From: Rahul Singh <rsingh@valhalla.cs.wright.edu>
- Date: Fri, 19 Apr 1996 17:18:05 -0400
- To: sage-bugs@extreme.indiana.edu
- Subject: default option in a switch statement.
- Cc: ktomko@valhalla.cs.wright.edu
- Sender: owner-sage-bugs@extreme.indiana.edu
1. For the following switch statement:
switch (i)
{
case 10:
printf("The value of i is %d", i);
printf("The value of j is %d", j);
break;
case 20:
printf("The value of k is %d", i);
printf("The value of l is %d", j);
break;
default:
printf("xxxxxxxxxxxxx");
}
2. The following fragment:
for (int i=0; i < H->numberOfCaseOptions(); i++){
H->caseOption(i)->unparsestdout();
H->caseOption(i)->nextInChildList()->unparsestdout();
if (i == H->numberOfCaseOptions()-1)
H->lastExecutable()->unparsestdout();
else
H->caseOption(i+1)->nodeBefore()->unparsestdout();
}
3. Gave the following output:
case 10:
printf("The value of i is %d", i);
break;
case 20:
printf("The value of k is %d", i);
printf("xxxxxxxxxxxxx");
4. Looks like the default case is not considered as a caseOption().
Rahul