Code Styling (formatting): Enhancing Your Code Readability
Introduction
Always make your code clean and tidy. This will enhance the readability for your code, and accordingly saving a lot of time (and somtimes saving lives).
Better Errors Detection
Styling your code during development makes it easier to detect basic errors, like braces inbalances (i.e missing or excessive braces).
Healthy Collaboration
When you work with a team, you have to make your code representing your logic very clearly. This will also guarantees a healthier friendships (if your team members are also your friends).
Maintainability
With a good code quality, you can always return back to your code after a long time to make some edits and new features.
Formatting Your Code on Visual Studio Code
Install the C/C++ Extension
Use Shortcuts During Coding
After finishing several lines of code let the Visual Studio Code auto-style your code using Ctrl+Shift+I
. You can also do it for the entire source code.