#include<stdio.h>
#include<conio.h>
void insert(int arr[]);
# define LEN 10
int count;
void main(void)
{
clrscr();
int arr[]={20,21,22,23,24};
insert(arr);
getch();
}
void insert(int arr[])
{
if(size==count)
printf("no space");
return;
int index,value;
printf("enter index and value");
scanf("%d %d",index,value);
for(int i=count-1;i>=index;i--)
{
arr[i+1]=arr[i];
arr[i]=value;
count++;
}
printf("insert succcess");
}
1
A
回答
2
6
你必须在这条线不正确的分号:
void main(void);
,你忘了分号在这条线:
arr[i=1]=arr[i]
您的代码也有其他错误。例如,这样的:
if(size==count)
printf("no space");
return;
将总是回报。它等效于:
if(size==count) {
printf("no space");
}
return;
,是为什么你应该得到正确的缩进你的代码的习惯,并获得在使用大括号的条件语句的习惯,一个很好的例子。
此外,size
尚未在任何地方声明。最后,这:
scanf("%d %d",index,value);
是不会做你想做的。你需要给 指针指向你想要存储值的整数,而不是那些整数的值。
相关问题
- 1. 错误:终止声明不正确
- 2. C++ Builder [bcc32错误] Unit1.cpp(18):E2040声明不正确地终止
- 3. MySQL声明不正确
- 4. 阿达 - 任务终止错误 - “声明预计”
- 5. dbus-C++中的声明错误,终止进程
- 6. UPS向NetSuite nlapiRequestURL收到“XML声明格式不正确”错误
- 7. 由于声明不正确而导致输出错误?
- 8. 孩子没有正确地终止叉
- 9. ISO C++禁止声明错误
- 10. 该声明将被终止SQL Server
- 11. 错误地使用前向声明?
- 12. 错误声明时,当地阵列
- 13. 语法错误:缺少;在正常声明之前的声明
- 14. while循环不会终止正确
- 15. Kotlin类实例声明不正确
- 16. Java包声明:Netbeans说:'包不正确'
- 17. P/Invoke声明看起来不正确
- 18. C++错误:正向声明'struct ...?
- 19. 正确的变量声明
- 20. 声明TextView错误
- 21. C#声明错误
- 22. 匹配错误,同时证明终止功能在不锈钢
- 23. 错误:列名不明确
- 24. 更新声明SQL错误不正确的语法SliderTitle和Where语句
- 25. “Windows错误报告停止支持”声明所需的说明
- 26. Cython错误:声明不声明任何东西
- 27. 致命错误:不能重新声明calculateAge()之前声明
- 28. Haskell错误错误地终止字符常量
- 29. 如何正确使用JTI声明来防止重播攻击?
- 30. 不能重新声明RecursiveCategories()错误
请点击编辑,选择您的代码并在顶部按1010按钮 – 2010-09-30 12:13:32
您在哪里声明了int大小? – 2010-09-30 12:16:14