让我说我有这个
char *something[] = {
"/bi",
"-c",
"5",
NULL,
NULL
};
Run Code Online (Sandbox Code Playgroud)
但是我想用十六进制声明它,我该怎么做呢; 编译器一直在向我发错:
char *something[] = {
{0x2f,0x62,0x69},
{0x2d,0x63},
{0x35},
{0x00},
{0x00}
};
Run Code Online (Sandbox Code Playgroud)
为此添加其他内容,0x00总是为空?0x00总是在NULL为-1的系统上转换为NULL?
您可以在字符串文字中使用十六进制转义序列.例如:
char *something[] = {
"\x2f\x62\x69",
"\x2d\x63"
};
Run Code Online (Sandbox Code Playgroud)