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版)
声明
|
179
声明
volatile short * restrict vsPtr; //
一个限定指针,指向
volatile short
对指针类型来说,在星号右边的类型限定符,其限定的是指针本身,而在星号左边的类
型限定符,其限定的是指针所指向的对象类型。在最后一个示例中,指针
vsPtr
使用限
定符
restrict
,该指针所指向的对象使用限定符
volatile
。更多的细节,包括关于限定
指针(
restricted pointer
)的详细信息,请见
9.3
节。
11.1.4 声明和定义
可以不限次数地声明一个标识符,但是在其作用域内,只有一个声明能作为定义。将具
有外部链接的对象和函数的定义放在头文件中,就很容易造成重复定义,因此,要尽量
避免这么做。
在下面的例子中,标识符的声明同时也是定义:
•
如果在声明函数时同时出现了函数块,则该函数的声明同时也是定义。例如:
int iMax( int a, int b ); //
这是一个声明,不是一个定义
int iMax( int a, int b ) //
这是一个函数的定义
{ return ( a >= b ? a : b ); }
•
如果在对象声明时给该对象分配内存,那么该对象的声明同时也是定义。具有初始
化器的声明是定义。而且,函数块内所有的声明都是定义,除非具有存储类修饰符
extern
。下面是一些例子:
int a = 10; // a
的定义
extern double b[];
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