Hi everyone, im a beginner and a project Im working on has to have a function that copies a string to a 2D array row by row from an input of list of names by the user. This is the format it should be in, how would i complete this?
sorry, yes character by character into a 2D array. The function copies as many characters as it can. If the array is bigger than the string then the function fills the unused positions with spaces. If the string is bigger than the array then the function stops copying as soon as the array is full.
void copyStr( const std::string & src, char dst[], size_t capacity ) {
// copy at most capacity characters from src to dst
// if src.size() < capacity then fill remaining elements in dst with ' '
}