diff options
author | himanshu81494 <himanshu81494@gmail.com> | 2015-10-08 15:31:40 +0530 |
---|---|---|
committer | himanshu81494 <himanshu81494@gmail.com> | 2015-10-08 15:31:40 +0530 |
commit | e8248af13431ca87786fff17a605189c69aacf15 (patch) | |
tree | 6c53e83834a83ffbd17211e7e7dddb7df2c7b839 /c.html.markdown | |
parent | 626ee03fc3ca27698044db118bd53f563d22ccd0 (diff) |
Update c.html.markdown
Diffstat (limited to 'c.html.markdown')
-rw-r--r-- | c.html.markdown | 20 |
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 /////////////////////////////////////// |