How to store array in string?(in c language )

suppose I have a array arr1 = {1 2 3 4 5};
i want to store the value of this array in string
How can we do this ??

I don’t know the best way to do this but you can try this-

string s = “”;
for(int i=0; i<n; i++){
s+=to_string(arr1[i]);
}

Here n is the size of the array.