-1
的strcpy
线下面的代码中抛出这个错误:C解释运行时错误:内存访问冲突收到
C interpreter runtime error: Memory access violation received.
如何解决这个问题?
int i = 1, len;
char msg[2000];
//I have 2 strings which I need to send one by one sequentially
char *txt1 = "I am first text";
char *txt2 = "I am second text";
for (i = 1: i < 3; i++)
{
strcpy(msg, txt[i]);
lr_output_message(msg);
len = strlen(msg);
}
什么是'txt'? “(i = 1:i <3; i ++)”中的':'是什么?请发布真实的代码。 –
也许'char * txt [] = {“我是第一个文本”,“我是第二个文本”}和'for(i = 0:i <2; i ++)' – LPs
@LP你的意思是'我<3'我想。 –