wchar_t VS string

what's the different between wchar_t and string?

thanks
Last edited on
wchar_t is a data type and string is class to manipulate characters
can char have more than one character ?
No. For example,
char c='z';
is correct but
char c="asdf"; is imposible to compile. Only
1
2
char *g="asdf";
char b[]="asdf; 

are valid choices. But g or b just point to those characters.
can char have more than one character ?

No as char is one character but you can create an array
eg:
char array[] = "Hello!";

EDIT: Submitted too late
Last edited on
char *g="asdf";

why does it legal/ what is the value of g, after char *g="asdf";
It makes g pointing to a constant array generated by the compiler.
The value of g would be the location of the character 'a' of that array.
What about
char c = '1234';

Bwah hah ha hah haaah!

BTW. Don't use multi-character constants. They're evil.

;-)
Topic archived. No new replies allowed.