调试C程序,报错:warning C4047: '=': 'CHAR16' differs in levels of indirection from 'char [2]'
代码如下:
CHAR16 StrBuffer[3] = {0};
...
StrBuffer[0] = Key.UnicodeChar;
StrBuffer[1] = '\n';
StrBuffer[2] = "G"; //报错!
当给StrBuffer赋值字符串"G"的时候报错。网上找到了答案:
原来,用双引号的"G"是字符串字面量( string literal),如果需要字符常量(character constant)的话,就用单引号:
StrBuffer[1] = '\n';
StrBuffer[2] = 'G'; //用单引号
问题解决。