• Post author:
  • Post category:Blog
  • Reading time:1 mins read
  • Post last modified:June 12, 2024

Is the following declaration valid?

int var, var;
  • No
  • Yes
Explanation & Hints:

No, the declaration int var, var; is not valid in C (and most other programming languages) because it attempts to declare the same variable var twice in the same scope. This results in a compilation error due to the redefinition of the variable name. Each variable in a given scope must have a unique identifier.

For more Questions and Answers:

Basic data types, operations, and flow control (decision-making statements) Module 2 Test Answers Full 100%

Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments