sudo apt-get install clang-format
Once you have installed Clang-format, you can verify the installation by running the following command:
clang-format --version
clang-format version 10.0.0-4ubuntu1
Install clang-format extension on VSCode-> https://marketplace.visualstudio.com/items?itemName=xaver.clang-format
To automatically save a file on save, add the following to your vscode settings file:
{
"editor.formatOnSave": true
}