[Solved] Why can’t variables be declared and modified at once? (C++)

[ad_1]

You practically already answered your question: Because declaration does not assign a value. Therefore your second sample never makes sense.

The first sample consists of two separate statements each of which could make sense in a certain context. Therefore it compiles.

1

[ad_2]

solved Why can’t variables be declared and modified at once? (C++)