The following code:
char sample_array[4] = {"a","b","c","d"};
when compiled, produces the following error message:
initialization to `char' from `const char *' lacks a cast
Why?
you should use single quotes for 'char' not double quotes which are for "strings"
I'm an idiot...thanx...I need coffee!
You should do like this : char sample_array[4] = {'a','b','c','d'}; 'a' is a character ,but "a" is a string!
Log in to post a comment.
The following code:
char sample_array[4] = {"a","b","c","d"};
when compiled, produces the following error message:
initialization to `char' from `const char *' lacks a cast
Why?
you should use single quotes for 'char' not double quotes which are for "strings"
I'm an idiot...thanx...I need coffee!
You should do like this :
char sample_array[4] = {'a','b','c','d'};
'a' is a character ,but "a" is a string!