Download interventions.json from VishwaK03/Error-Driven-Learning-Reinforcement-Engine: direct link, hf CLI and curl.
- Browser
- Download file 4.27 kB
-
https://huggingface.co/spaces/VishwaK03/Error-Driven-Learning-Reinforcement-Engine/resolve/main/interventions.json
- Command line
-
hf download hf://spaces/VishwaK03/Error-Driven-Learning-Reinforcement-Engine/interventions.json
-
curl -L -o interventions.json https://huggingface.co/spaces/VishwaK03/Error-Driven-Learning-Reinforcement-Engine/resolve/main/interventions.json
4.27 kB
| { | |
| "integer_division_trap": { | |
| "level_1": "π‘ Hint: You are dividing two integers. What happens to the decimal? (Watch video)", | |
| "level_2": "β οΈ Error: Integer division (15/100) results in 0, not 0.15. (Watch video)", | |
| "level_3": "π Fix: Add '.0' to one of the numbers to perform float division. (Watch video)", | |
| "title": "Integer Division Trap", | |
| "concept": "In C, dividing two integers discards the decimal part completely.", | |
| "fix": "Cast one variable to (float) or add .0 to constants.", | |
| "bad": "float x = 15 / 100;", | |
| "good": "float x = 15.0 / 100.0;" | |
| }, | |
| "assignment_in_condition": { | |
| "level_1": "π‘ Hint: Check the operator inside your 'if' statement. (Watch video)", | |
| "level_2": "β οΈ Error: You are assigning (=) instead of comparing (==). (Watch video)", | |
| "level_3": "π Fix: Change '=' to '==' for comparison. (Watch video)", | |
| "title": "Assignment vs Equality", | |
| "concept": "Using single '=' inside 'if' assigns a value, which is usually true.", | |
| "fix": "Use '==' for comparison.", | |
| "bad": "if (x = 5) { ... }", | |
| "good": "if (x == 5) { ... }" | |
| }, | |
| "scanf_missing_ampersand": { | |
| "level_1": "π‘ Hint: Scanf needs to know the memory address. (Watch video)", | |
| "level_2": "β οΈ Error: You missed the '&' symbol in scanf. (Watch video)", | |
| "level_3": "π Fix: Add '&' before the variable name. (Watch video)", | |
| "title": "Missing & in Scanf", | |
| "concept": "Scanf requires a pointer to the variable location.", | |
| "fix": "Add '&' operator.", | |
| "bad": "scanf(\"%d\", val);", | |
| "good": "scanf(\"%d\", &val);" | |
| }, | |
| "array_out_of_bounds": { | |
| "level_1": "π‘ Hint: Check your array index. (Watch video)", | |
| "level_2": "β οΈ Error: You are accessing memory outside the array. (Watch video)", | |
| "level_3": "π Fix: Array indexes start at 0 and end at size-1. (Watch video)", | |
| "title": "Array Out of Bounds", | |
| "concept": "Accessing invalid indexes causes garbage values or crashes.", | |
| "fix": "Ensure index < size.", | |
| "bad": "int a[3]; a[3] = 5;", | |
| "good": "int a[3]; a[2] = 5;" | |
| }, | |
| "memory_leak": { | |
| "level_1": "π‘ Hint: You allocated memory but didn't clean up. (Watch video)", | |
| "level_2": "β οΈ Error: Dynamic memory (malloc) must be freed. (Watch video)", | |
| "level_3": "π Fix: Add 'free(ptr)' before return. (Watch video)", | |
| "title": "Memory Leak", | |
| "concept": "Memory from malloc stays occupied until you free it.", | |
| "fix": "Use free() when done.", | |
| "bad": "p = malloc(n); return;", | |
| "good": "p = malloc(n); free(p); return;" | |
| }, | |
| "null_pointer_dereference": { | |
| "level_1": "π‘ Hint: This pointer might be pointing to nothing. (Watch video)", | |
| "level_2": "β οΈ Error: You are writing to NULL. (Watch video)", | |
| "level_3": "π Fix: Initialize the pointer with a valid address. (Watch video)", | |
| "title": "Null Pointer Crash", | |
| "concept": "Dereferencing NULL causes a Segmentation Fault.", | |
| "fix": "Assign valid address before use.", | |
| "bad": "int *p = NULL; *p = 5;", | |
| "good": "int v; int *p = &v; *p = 5;" | |
| }, | |
| "uninitialized_variable": { | |
| "level_1": "π‘ Hint: This variable has no value yet. (Watch video)", | |
| "level_2": "β οΈ Error: Using uninitialized variable leads to garbage data. (Watch video)", | |
| "level_3": "π Fix: Assign a value (e.g., = 0) when declaring. (Watch video)", | |
| "title": "Uninitialized Variable", | |
| "concept": "Variables contain random memory junk until initialized.", | |
| "fix": "Initialize on declaration.", | |
| "bad": "int x; printf(\"%d\", x);", | |
| "good": "int x = 0; printf(\"%d\", x);" | |
| }, | |
| "string_equality_error": { | |
| "level_1": "π‘ Hint: Can you compare strings using '==' in C? (Watch video)", | |
| "level_2": "β οΈ Error: In C, '==' compares memory addresses of strings, not the text. (Watch video)", | |
| "level_3": "π Fix: Use the 'strcmp()' function from string.h. (Watch video)", | |
| "title": "String Comparison Error", | |
| "concept": "Strings are pointers in C; you must use strcmp for content comparison.", | |
| "fix": "Use strcmp(str1, str2) == 0.", | |
| "bad": "if (str == \"admin\")", | |
| "good": "if (strcmp(str, \"admin\") == 0)" | |
| } | |
| } |