45 degrees optimizes the horizontal distance hypothetically. On Earth, this value is closer to 42 degrees. To echo what Prince Grey said, a horizontally launched projectile would be immediately pulled to the ground by gravity. (This assumes you are on a planet with gravity like Earth.)