mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 17:41:41 +00:00
Update c.html.markdown
This commit is contained in:
parent
626ee03fc3
commit
e8248af134
@ -308,6 +308,24 @@ int main(void) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// using "goto"
|
||||||
|
typedef enum { false, true } bool;
|
||||||
|
// for C don't have bool as data type :(
|
||||||
|
bool disaster = false;
|
||||||
|
int i, j;
|
||||||
|
for(i=0;i<100;++i)
|
||||||
|
for(j=0;j<100;++j)
|
||||||
|
{
|
||||||
|
if((i + j) >= 150)
|
||||||
|
disaster = true;
|
||||||
|
if(disaster)
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
error :
|
||||||
|
printf("Error occured at i = %d & j = %d.\n", i, j);
|
||||||
|
// this will print out "Error occured at i = 52 & j = 99."
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////
|
///////////////////////////////////////
|
||||||
// Typecasting
|
// Typecasting
|
||||||
///////////////////////////////////////
|
///////////////////////////////////////
|
||||||
|
Loading…
Reference in New Issue
Block a user