assign variable with sed not working

C++
comp=$(echo "$fullName"  | sed 's/ //g')
Source

Also in C++: