Function not returning anything

I have two functions: checkCollision feeds an array of SDL_Rect into actCollision, which checks and and changes the values based on certain criteria.

The program runs, but the function is not returning any data, and the "quit" function it points to, while working when not pointed to by the said function, causes the program to crash rather then cleanly close.

The two functions I believe are the problem:

The entire code:
Last edited on
Are you talking about the stop() function? You should probably not be calling that function deep within your program like that. Instead set quit to true and the stop function will get called after the main loop.
The stop function is only part of the problem, the main issue is that actCollision isn't working at all, it does not change the values of what is put into it.
First of all you should make sure that all the functions that has a return type other than void actually returns a value. If you don't want a function to return anything you should change the return type to void.

The problem with actCollision is that defenderType is a copy of the argument you passed to the function so any changes made to defenderType will not affect the variable you passed as argument.
Last edited on
Firstly, thanks for your help so far, as you can probably tell I am not that experienced at programming. Secondly, how would I change the variable that I am passing through?
the functions aren't returning data, since there is no return statement in every if or else if
Last edited on
the only function that should be returning data is actCollision, which points to stop() which returns 0 or it returns int defenderType
Topic archived. No new replies allowed.