Skip to Content
C语言核心技术(原书第2版)
book

C语言核心技术(原书第2版)

by Peter Prinz, Tony Crawford
August 2017
Intermediate to advanced
798 pages
17h 44m
Chinese
China Machine Press
Content preview from C语言核心技术(原书第2版)
使用
IDE
|
775
使用
IDE
22.4.3 在调试器中控制程序的执行
要使得该程序运行到下一个断点(此例中断点设置在调用函数
swap()
之
前),单击工具
栏中的
Resume
图标(见图
22-7
),或按
<F8>
。突出显示的行始终表示接下来将要执行该
语句。
图22-7:Debug工具栏
单击
Step Into
开始函数调用,会跳转到函数
swap()
的第一行。
Variables
视图如图
22-8
所
示,现在显示本地指针
p1
和
p2
的值,以及它们指向的变量的值。
图22-8:Variables视图
当在源代码编辑器中将鼠标指针停留在一个变量上时,在
Debug
透视图中,该变量的值也
会显示。在
Variables
视图中,还可以在程序各步之间更改变量的值,而不改变源代码。当
希望仅在当前调试会话下采用不同的值来测试程序的行为时,这种方式非常实用。
如果单击
Step Return
,程序运行到当前函数结束,或者更确切地说,直到函数调用后的第
一个语句。但是因为我们想要观察函数局部变量的值,我们将在函数
swap()
中逐步通过
三行。(另一种办法是在函数的末尾设置一个断点,并在此处再次检查变量的值。)在
Variables
视图下,可以看到只有指针的值被交换,而不是它们指向的变量
*p1
和
*p2
的值。
这就是函数
swap()
的逻辑错误所在。对于更正后的版本,请参见
21.2
节的最后部分。
22.5 关于Eclipse的更多信息
在
Eclipse
上最重要的资源可通过在
Help
菜单下单击进入
Welcome
→
Overview
访问。为
了最有效地利用 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

算法精讲视频课程:24篇系列讲座

算法精讲视频课程:24篇系列讲座

罗伯特·塞奇威克, 凯文·韦恩(Kevin Wayne)

Publisher Resources

ISBN: 9787111562207