Error不可怕解决就是啦
(づ ̄3 ̄)づ╭❤~
Error 1
- 一个超级经典的错误!
- overflow
- 栈不空就遍历输出(但是仅遍历是不会导致栈空的所以是典型的
while(true)
error)
push (s,3634);
push (s,90);
//typical error
//hhhhhhhhh(now I'm the girl had the overflow error :) yehhhhhh)
while(! isempty(s)){
printf("\n%d",s->data[i++]);
}
test=1
1
4
3634
90 //栈遍历完了
538976288//从这开始指针开始放飞自我了hhh
538976288
538976288
-14671840
0
0
-2080374652
20551
7209152
7209152
0
0
0
Error 2
[errror]Id returned 1 exit status
- 库函数拼写错误。如:printf,scanf 等
- 定义的函数名在调用时,函数名拼写错误
- 在执行函数时可能函数体本身存在的问题
!!!
入口函数(main函数不正确 / 找不到main函数)但其余正常编译
(suspect : 编译无调用于是仅返回编译状态)
qwq 忘记main函数的是只有我一个么??? 卑微
Error 3
assignment to expression with array type
数组名不能被赋值,即数组名不能作为赋值表达式的左值,初始化时除外。
而同样的情况下,指针是可以这样赋值的
原因
:数组声明后会在内存空间中开辟一段空间,而数组名指向那段内存空间的首地址,它相当于一个常量指针,所存放的地址不变
,就像我们不能改变常量的值一样。因此数组名不能作为赋值表达式的左值。help
例如:
int *array[100];
array = (int *)malloc(sizeof(int)*100);
错误
再如:
char str1[];
char str2[] = “hello,world!”
str1 = str2;
错误
//wrong
struct snode{
int data[maxsize]; //wrong!!!
int top;
int smaxsize;
};
//right
struct SNode {
int *Data; /* 存储元素的数组 */
int Top; /* 栈顶指针 */
int MaxSize; /* 堆栈最大容量 */
};
Stack CreateStack( int MaxSize )
{
Stack S = (Stack)malloc(sizeof(struct SNode));
S->Data = (int *)malloc(MaxSize * sizeof(int));// wrong写法中的报错语句
S->Top = -1;
S->MaxSize = MaxSize;
return S;
}
ERROR 4
UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 98: illegal multibyte sequence
- 使用python的时候经常会遇到文本的编码与解码问题,此为其中很常见的一种解码错误
referene