+ 11
Can anyone explain this code with the output?
6 Respostas
+ 7
Anyone explain this code plz!
+ 4
It's ok Niloufar.Km
+ 4
Niloufar.Km ping me when it is possible
+ 2
That is a "try block" used to catch runtime errors and exceptions.
When an error occurs it might return an exception number. if its exception number 3 or 4, then that value would be passed to catch like a normal method, take the place of x, and then execute the block as written. in this case it would print itself to the console. If no runtime error occurs then this is all skipped and the code continues.
http://www.cplusplus.com/doc/tutorial/exceptions/
+ 1
For iOS/Web users:
Language: C++
What is the output of this code?
try {
throw 3;
throw 4;
}
catch(int x) {
cout << x;
}
0
link is broken. goes to a "page not found" page.
maybe the code reference was removed?