How to switch between multiple GCC and G++ compiler versions on Ubuntu 20.04 LTS Focal Fossa
In this tutorial we will install multiple versions of GCC and G++ compilers using the apt install command. Furthermore, by use of the update-alternatives tool you will learn how to easily switch between multiple GCC and G++ compiler versions and how to check the currently selected compiler version.
https://linuxconfig.org/how-to-switch-between-multiple-gcc-and-g-compiler-versions-on-ubuntu-20-04-lts-focal-fossa