Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
17 changes: 17 additions & 0 deletions chapter10/ch10s02.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// http://docs.linuxtone.org/ebooks/C&CPP/c/ch10s02.html
#include <stdio.h>

int main(void)
{
int sum = 0, i = 0;
char input[5];

while (1) {
scanf("%s", input); // add '\0' automatically
for (int i = 0; input[i] != '\0'; i++) {
sum = sum*10 + input[i] - '0';
}
printf("input=%d\n", sum);
}
return 0;
}
15 changes: 15 additions & 0 deletions chapter10/ch10s02Practice.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// http://docs.linuxtone.org/ebooks/C&CPP/c/ch10s02.html
#include <stdio.h>

int main(void)
{
int i;
char str[6] = "hello";
char reverse_str[6] = "";
printf("%s\n", str);
for (i = 0; i < 5; i++)
reverse_str[4 - i] = str[i];
reverse_str[5] = '\0';
printf("%s\n", reverse_str);
return 0;
}
Binary file renamed chaper10/main → chapter10/main
Binary file not shown.
Binary file added chapter10/practice
Binary file not shown.
28 changes: 28 additions & 0 deletions chaper10/readme.md → chapter10/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,31 @@ set var sum=0


## 断点

display : 每次停下来都现实值
```shell
display sum
```
undisplay 取消跟踪

设置断点 break命令(简写为b)
```shell
b 9
```
break命令的参数也可以是函数名,表示在某一个函数开头设断点

**使用continue指令连续运行(简写c),程序遇到断点自动停下**

i breakpoints 显示设置的断点

停用断点
```shell
disable breakpoints 3
```
启用
```shell
enable breakpoints 2
```
删除断点
```shell
delete breakpoints