contributed by < brad84622 >
$ sudo apt install build-essential git-core cppcheck clang-format
digraph {
node[shape=box]
tail [shape=plaintext,label=tail]
head [shape=plaintext,label=head]
{rank=same;a,b,c,NULL}
a->b
b->c
NULL[shape=plaintext]
c->NULL
head->a
tail->c
}
digraph {
node[shape=box]
tail [shape=plaintext,label=tail]
head [shape=plaintext,label=head]
{rank=same;a,b,c,NULL,newh}
newh->a
a->b
b->c
NULL[shape=plaintext]
c->NULL
head->newh
tail->c
}
digraph {
node[shape=box]
tail [shape=plaintext,label=tail]
head [shape=plaintext,label=head]
{rank=same;a,b,c,NULL,newt}
a->b
b->c
c->newt
NULL[shape=plaintext]
newt->NULL
head->a
tail->newt
}
digraph {
node[shape=box]
tail [shape=plaintext,label=tail]
head [shape=plaintext,label=head]
{rank=same;b,c,NULL}
b->c
NULL[shape=plaintext]
c->NULL
head->b
tail->c
}
digraph {
node[shape=box]
tail [shape=plaintext,label=tail]
head [shape=plaintext,label=head]
{rank=same;a,b,c,NULL}
b->a
c->b
NULL[shape=plaintext]
a->NULL
head->c
tail->a
}
$ make test
scripts/driver.py
...
# Test of truncated strings
ERROR: Segmentation fault occurred. You dereferenced a NULL or invalid pointer
--- trace-06-string 0/7
...
--- TOTAL 93/100
# Test of truncated strings
option fail 0
option malloc 0
new
ih aardvark_bear_dolphin_gerbil_jaguar 5
it meerkat_panda_squirrel_vulture_wolf 5
rh aardvark_bear_dolphin_gerbil_jaguar
reverse
rh meerkat_panda_squirrel_vulture_wolf
option length 30
rh meerkat_panda_squirrel_vulture
reverse
option length 28
rh aardvark_bear_dolphin_gerbil
option length 21
rh aardvark_bear_dolphin
reverse
option length 22
rh meerkat_panda_squirrel
option length 7
rh meerkat
reverse
option length 8
rh aardvark
option length 100
rh aardvark_bear_dolphin_gerbil_jaguar
reverse
rh meerkat_panda_squirrel_vulture_wolf
free
quit
void q_reverse(queue_t *q) {
/* You need to write the code for this function */
if (q == NULL || q->size == 0) {
} else {
list_ele_t *prev, *cur, *nt;
prev = q->head;
cur = prev->next;
nt = cur->next;
prev->next = NULL;
cur->next = prev;
prev = cur;
cur = nt;
int i;
for (i = 0; i < (q->size) - 2; i++) {
nt = nt->next;
cur->next = prev;
prev = cur;
cur = nt;
}
q->tail = q->head;
q->head = prev;
}
}
void q_reverse(queue_t *q) {
/* You need to write the code for this function */
if (q == NULL || q->size == 0||q->size==1) {
} else if(q->size==2) {
q->tail->next=q->head;
q->head->next=NULL;
q->head=q->tail;
q->tail=q->tail->next;
} else {
list_ele_t *prev, *cur, *nt;
prev = q->head;
cur = prev->next;
nt = cur->next;
prev->next = NULL;
cur->next = prev;
prev = cur;
cur = nt;
int i;
for (i = 0; i < (q->size) - 2; i++) {
nt = nt->next;
cur->next = prev;
prev = cur;
cur = nt;
}
q->tail = q->head;
q->head = prev;
}
}
$ make test
gcc -O0 -g -Wall -Werror -c queue.c
gcc -O0 -g -Wall -Werror -o qtest qtest.c report.c console.c harness.c queue.o
scripts/driver.py
--- Trace Points
...
--- TOTAL 100/100
or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing