How char array converted to string whereas here it is showing error?

in sort of string lecture sir has converted character array into string and retruned so that it can assigned to string but what is the problem here ??