Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
184 views
in Technique[技术] by (71.8m points)

Why does VS Code not allow me to use for each loops or declare arrays properly in C++?

I recently downloaded VS Code on a Mac and installed the C++ extension. For some reason, when I declare

    int arr[]{ 0, 1, 1, 2, 3, 5, 8 };

in my main, as I always have, I get the error

error: definition of variable with array type needs an explicit size or an initializer

followed by

error: expected ';' at end of declaration

The exact same code runs on my VS Code on Windows. Does anyone know the problem I am having? For each loops also strangely do not work.

question from:https://stackoverflow.com/questions/65932624/why-does-vs-code-not-allow-me-to-use-for-each-loops-or-declare-arrays-properly-i

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...