-
-
Notifications
You must be signed in to change notification settings - Fork 264
error: variable-sized object may not be initialized #394
Copy link
Copy link
Closed
Description
Full error message:
/home/insights/insights.cpp:8:10: error: variable-sized object may not be initialized
int arr[num] {};
^~~
1 error generated.
Error while processing /home/insights/insights.cpp.
During following code running:
#include <iostream>
int main()
{
int num;
std::cin >> num;
int arr[num] {};
for (auto& item : arr)
{
std::cout << item << " ";
}
std::cout << std::endl;
}
The error is shown for C++ standards from 11 to 20a.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels