What is the difference between using string type and char type to store a name?
In terms of Performance, Effectiveness? Anything? and what are the good practices?
In string data type and char, there is no difference they both same. Char is basically an array of characters which make string and string data type is the array of characters so there is no difference. To define a string in c like languages we use char because there is no string data type but when c++ and java or other languages comes then they come with a dedicated string data type to create strings easily just using 'string' data type. In terms of performance char is faster than string. And also string is an immutable data type. While char can be updated.
Using char you can manage memory efficiently as it will store specific space for the array of strings whereas using string a specified space will be stored even if it is not filled.
Martin Taylor I know I'm not talking about only c++ I posted just general answer.
Maninder $ingh I tend to believe that saying that a C-style string performs better than a C++ string,is nothing short of a myth. In what respect(s) is it better? I think that in most cases,the operations performed on a C++ string are faster than their C-style string counterparts.
Anthony Maina yes you are right. For more information, if anyone has still doubt and confusion can check this on the StackOverflow. https://stackoverflow.com/questions/1287306/difference-between-string-and-char-types-in-c#:~:text=Strings%20are%20a%20lot%20more,more%20efficient%20for%20the%20computer.&text=Well%2C%20string%20type%20is%20a,a%20character%20string%20for%20you.