January 12th, 2013, 03:14 AM
what is the difference between the following declarations in terms of memory and internal processing in c?
>>>> char='a'; Vs string="a";
January 12th, 2013, 03:35 AM
How is the Vs type defined? In 23 years of professional C and C++ programming, I have never ever seen it until right now.
January 12th, 2013, 11:30 AM
Techically, there is no difference. They are both errors. But answering the question:
Originally Posted by Viky
char var = 'a'; defines a single character named var with the value of 'a'
string var="a"; defines a string variable (essentially a multi-character array) named var with the value of the single character 'a'.
More characters can be defined or added to a string. They cannot be added to a char since it defines only a single value.