January 12th, 2013, 11:30 AM
Join Date: Feb 2004
Time spent in forums: 2 h 26 m 27 sec
Reputation Power: 0
Originally Posted by Viky
what is the difference between the following declarations in terms of memory and internal processing in c?
>>>> char='a'; Vs string="a";
Techically, there is no difference. They are both errors. But answering the question:
char var = 'a';
defines a single character named var
with the value of '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.