Im stuck at stage #EZ5. Everytime I push it to the master branch, it says my code is returning “”, even if locally everything is alright.
I could just copy the code from one of the examples, but I wanted to stick to what I did alone and I want to know if it’s anything I’ve done wrong or it’s fault of the server side.
The for loop in your function type() does out of bounds access on the array (sizeof(builtin) is the size of Builtin times number of elements in the array… and not just the number of elements in the array)
So instead of:
builtinTypes type(string args) {
for(int i = 0; i < sizeof(builtin); i++) {
...
You do this:
builtinTypes type(string args) {
for(int i = 0; i < (sizeof(builtin) / sizeof(Builtin)); i++) {
...
Note: the codecrafter testers will immediatly abort the program with exit code -1 if it EVER dereference memory that is not allocated (out of bounds array access for example)
Honestly could get some clarification that a memory error was detected…
You can use valgrind to check if your program has memory errors or not