我的代码不起作用。我收到一个字符串的时候出现运行时错误。这段代码有什么问题?错误读取字符串
//this is what i have in main()
char *ele,*s[max];
int *count,temp=0;
count=&temp;
printf("Enter string to insert: ");
scanf("%s",ele);
addleft(s,ele,count);
//following is the function definition
void addleft(char *s[max],char *ele,int *count)
{
int i;
if((*count)==max)
{
printf("Queue full!\n");
return;
}
for(i=*count;i>0;i--)
strcpy(s[i],s[i-1]);
strcpy(s[0],ele);
(*count)++;
printf("String inserted at left!\n");
}
我会改变标题为“错误的代码执行导致错误的输入字符串处理”。这个标题听起来像是你在为输入的字符串指定错误的代码。 ;-) –
对不起,我不关注标题。现在对我来说更重要的是我要提交这个tom的代码:) – user1727119