Why don't I get ANY errors?

I recently turned in several assignments to my professor, who then let me know they all had compiler errors and warning. In my testing on Replit, I got a total of 0 when running the projects I submitted. I get some, ie. missing semicolons, but no error when -235143643 (or another integer that looks like that, I don’t recall the exact value) was used as the index for an array of length 20.

I’ve since fixed most of the errors I’m aware of, so I’m not going to provide a repl link, but I will include an example of some problematic code. The following code should produce an error, as count is not initialized to anything when it is used as the index to myArray in line 9. On replit, I’ve noticed that the compiler gives them some wild int value (like -235143643), which is still out of range and should still produce an error.

struct myStruct{
  // Fields.

int main(){
  myStruct myArray[];
  myStruct myStructInstance;
  int count;
  myArray[count] = myStructInstance;

I’m going to add that I don’t think this is urgent, since I’m using VS Code now, which does produce the errors, and is the IDE my professor uses as well.

Are you sure you put the code in the file being compiled?

Considering I haven’t touched any hidden files or main.debug, and the only compilable file I had in the project where I found this issue was main.cpp, which this code was in, yes.

This also isn’t the only occurrence of missing errors, and it’s quite frustrating.

Please post a link to the repl so that it is easier to understand then what is going on.

1 Like

Edit: I’ve restored the older version that wasn’t giving an error correctly. The specific line that should produce an error is line 152 in https://replit.com/@ThomasWarenski/M07-Programming-Assignment-2

1 Like

Hi @ThomasWarenski thanks for your link to the Repl.

When I forked and ran your code the program sort of works. There are issues with the item numbering not matching up to the item number input and entering 20 as an option causes the program to stop but apart from that it appears to work.

I looked at line 152 using debugger and got similar results each time I selected an item:

Can you please explain what it is you are expecting to cause an error here?