Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C 字符数组中的特殊字符_C - Fatal编程技术网

C 字符数组中的特殊字符

C 字符数组中的特殊字符,c,C,我试图从字符数组中检索一些文本,如下所示: unsigned char some_variable[3][10] = {"text1","text2","text3"}; int i; for(i=0;i<3;i++){ functionIcantChange(some_variable[i]) } unsigned char some_变量[3][10]={“text1”、“text2”、“text3”}; int

我试图从字符数组中检索一些文本,如下所示:

unsigned char some_variable[3][10] = {"text1","text2","text3"};

int i;

for(i=0;i<3;i++){
    functionIcantChange(some_variable[i])
}
unsigned char some_变量[3][10]={“text1”、“text2”、“text3”};
int i;

对于(i=0;i我建议您使用sprintf在数组的前后插入引号。您需要一些大的缓冲区来保存变量的值

char buffer[255];
sprintf(buffer, "\"%s\"", some_variable[i]);
functionIcantChange(buffer);

我需要一些类似于无符号字符变量[1][10]={“text1”}的内容,所以变量[0]返回“text1”而不是text1

逃避引用

char some_variable[3][10] = {"\"text1\"","\"text2\"","\"text3\""};

请参阅。

这应该是
char*某个_变量[]={…}
。如果要在字符串中加引号:
递归地说“你好”
。递归在哪里?我需要类似无符号char变量[1][10]={“text1”}的东西。因此变量[0]返回“text1”而不是text1@AndrewHenle这里的讨论很好:。另外:我建议忘记
sprintf
-使用
snprintf
。我同意这也是一个可能的解决方案……但我不确定是否允许修改他的“some_变量”