Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>About the try-catch block. <P>Error handling is <strong>fundamentally</strong> different in C than in Java, that was one of the main "selling points" of the Java language that was claimed to be an improvement over older languages like C. So there is no direct translation between the two regarding this point (as stated). <P><em>Perhaps similar to a native English speaker with no knowledge of other languages, he can not simply take an English-Urdu dictionary and translate what he wants to say directly into Urdu word-by-word. Chances are that it will come out very wrong. He needs to know how Urdu works, grammar, levels of politeness and formality, idioms etc. etc. etc.</em> <P><strong>Java</strong> throws exceptions, as you have seen in your code. <P><strong>C</strong> normally works by returning a value from a function to indicate it's success or failure (often 0=>SUCCESS and !=0=>Error code, but <strong>not always</strong>). Some functions also set a global variable to some value to indicate a problem. There is no standard way that this is done, so you would need to look up the documentation for each and every function that is called in the try block, check every function's return value in your C code, and handle appropriately*. <P>* = Appropriately in this case may mean that you need to think through the fundamental architecture of your C application (and understand the architecture of the Java application). Depending on complexity and application, it may be as simple as writing an error message to the screen and exiting, or as complex as appending an error message to e.g. a log file and continuing along some other path of execution.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload