The INF205 glossary document has been set up. Much of it is still under construction. We will periodically collect new suggested terms and definitions, still following the same principles as in no. 1 from lab u36.
The "memory leak" code example does not only have a bug (memory leak), it is also a showcase of poor programming style in many ways.
Do not spend much time on the second part of this problem. If it takes too long, just give a brief description of what you were doing, and go on with problem no. 3.
Two spheres are here understood to collide if they overlap, which is the case if the distance between their centres is smaller than the sum of the radii of the two spheres. We are now looking at a program that reads diameters and coordinates of spheres; it then counts and outputs the number of collisions between pairs of spheres.
The sphere collision detection example code has a very low-level data structure, using multiple arrays: Data on the same sphere are spread over multiple arrays, and they have the same array index in all these arrays. In old-fashioned legacy codes from the times before object-oriented programming, you will often find the data arranged in such a way.
Make the code more logical: Use struct, defining a struct Sphere, to group all the data that belong to the same sphere into one Sphere object.