How to create an array to store a variable h ?

I want to calculate the eigenvalues of a model under different variables, For example, in the xxz model,h can change.

What do I need to do to get a series of intrinsic energies under different parameters?

I tried to create an array directly in the program to store a series of values of a variable, but for some reason I reported an error.

Thank you very much if you can answer it

Hi Tan, Without more information about your code and the error message, it is hard to provide any detailed help. The recommended 1D array in C++ is

#include <vector>
N=10
std::vector<double> myEnergies(N) 

It sounds like this is not an ITensors issue/question so maybe you can get more assistance on a C++ forum.
I hope this helps.
JR