As others mentioned you want to use a streaming object or if you are using C++20 you want to use remove_if.
You may want to check this out. You will need to know how to use streams to be a developer.
What exactly does stringstream do?
Using @MikeCAT way
size_t concatArrrayNoZero(int[] a, size_t len){
std::stringstream ss;
for( auto i : a){
//add everything to buffer
ss<<i;
}
//convert the ss into a string
std::string str = ss.str();
//remove the '0' from the string then erase the extra space in the string
str.erase(std::remove(str.begin(), str.end(), '0'),
str.end());
//clear the buffer
ss.clear();
//put the nonzeros back into the buffer
ss<<str;
//make the return type
size_t r;
// get the data out of the buffer
r<<ss;
return r;
}
size_t is the max size unsigned integral type of your computer.
Also check out https://en.wikipedia.org/wiki/Erase%E2%80%93remove_idiom for why you have erase and remove