Programming: Declaring Multiple Variable with the Same Type on a Single Line

If multiple variables need to be declared and they are of the same type and they need to be initialized with the same value, this can be done in a single line using commas.



Usage: type variable1, variable2 = value; Example: int variable1, variable2 = 0;
Back to blog

Leave a comment

Please note, comments need to be approved before they are published.