Error handling.
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
int deep_function_3() {
|
||||
int result = non_existent_variable * 5;
|
||||
return result;
|
||||
}
|
||||
|
||||
int deep_function_2(int x) {
|
||||
printf("In deep_function_2 with x=%d\n", x);
|
||||
int value = deep_function_3();
|
||||
return value + x;
|
||||
}
|
||||
|
||||
int deep_function_1(int a, int b) {
|
||||
printf("In deep_function_1 with a=%d, b=%d\n", a, b);
|
||||
int sum = a + b;
|
||||
int result = deep_function_2(sum);
|
||||
return result;
|
||||
}
|
||||
|
||||
int main() {
|
||||
printf("=== Error Handling Demonstration ===\n");
|
||||
printf("This program will intentionally trigger an error\n");
|
||||
printf("to demonstrate the enhanced error reporting system.\n\n");
|
||||
|
||||
int final_result = deep_function_1(10, 20);
|
||||
printf("Final result: %d\n", final_result);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user