指针学的好水啊。。为了加深了对指针的运用 循环队列用了指针 链队列用了引用,还有就是在一个地方卡了好久好久,20多个报错无法编译通过要不要这么狠哇。。。最后发现是case内定义了新的变量惹
case里最好不要定义新的变量,否则会出现error:jump to case label,解决办法让case加上花括号或者变量的定义写在switch外边
以下是测试代码,,
头文件"130h.h"
#include <bits/stdc++.h> #define N 10 const int inf = 0x3f3f3f3f; struct node1 { int f, r, *a, num; }; struct node { int data; node *next; }; struct node2 { node *f, *r; }; void menu(); bool init1(node1 *&q); bool push1(node1 *q, int x); bool pop1(node1 *q); int front1(node1 *q); void visit1(node1 *q); bool init2(node2 &q); bool push2(node2 &q, int x); bool pop2(node2 &q); int front2(node2 q); void visit2(node2 q);