summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--c.html.markdown20
1 files changed, 19 insertions, 1 deletions
diff --git a/c.html.markdown b/c.html.markdown
index 8e1675bb..29bc5a5b 100644
--- a/c.html.markdown
+++ b/c.html.markdown
@@ -307,7 +307,25 @@ int main(void) {
exit(-1);
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
///////////////////////////////////////