Improving the solution to detect circle with circle collision detection given within the question:
float dx = circle1.x - circle2.x, dy = circle1.y - circle2.y, r = circle1.r + circle2.r;return (dx * dx + dy * dy <= r * r);
It avoids the unnecessary "if with two returns" and the use of more variables than necessary.