ubuntu中C++编译报错

我在运行Cpp-Primer-Plus 6th书中例题5.2时编写了如下程序

#include 
#include 


int main(){
    using namespace std;

    array<long double, 100> fac;
    fac[0] = fac[1] = 1;
    for (int i = 2; i <= 100; i++){
        fac[i] = fac[i-1] * i;

    };
    cout << fac[99];
    return 0;

}

但运行后终端输出为


*** stack smashing detected ***: terminated

并且在VScode中报出了如下错误

img


请问如何解决?万分感谢

数组大小是100,但for循环中i<=100,那么当i为100时, fac[100]越界了

没看出有什么问题,我这里可以运行(gcc)
9.33262e+155

你是不是配错了编译器,或者用的c语言编译器