Ace Your C++ Skills 2026 – Rock the ‘Thinking in C++’ Challenge!

Question: 1 / 565

What is true about defining variables anywhere within the scope in C++ compared to C?

It's illegal in both C++ and C

It was introduced to support object construction with initialization

In C++, variables can be defined anywhere within the scope, including inside functions, while in C, variables have to be defined at the beginning of a block. This feature was introduced in C++ to support object construction with initialization, making it a more convenient and readable option compared to C. The other options are incorrect because defining variables anywhere within the scope is not illegal in either C++ or C. It is also allowed in C++, and is not a compiler-specific feature, rather it is a part of the language itself.

Get further explanation with Examzify DeepDiveBeta

It is only allowed in C, not in C++

It is a compiler-specific feature, not part of the language

Next Question

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy