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版)
函数简介
|
323
函数简介
表17-21:处理内存区域的函数(续)
目的 在string.h中的函数 在wchar.h中的函数
寻找给定字符在内存区域
memchr() wmemchr()
第一次出现的位置
在内存区域填入给定字符值
memset()
、
memset_s() wmemset()
、
wmemset_s()
17.9 动态内存管理
许多程序,例如那些处理动态数据结构的程序,需要在运行时动态地分配和释放内存。
C
程序可以利用头文件
stdlib.h
中声明的四个动态内存管理函数,它们列举在表
17-22
中。
这些函数的使用方法在第
12
章中有详细介绍。
表17-22:动态内存管理函数
目的 函数
分配一个内存区域
malloc()
分配一个内存区域
,
并填入null字节
calloc()
重新分配一个内存区域
realloc()
释放一个内存区域
free()
17.10 日期和时间
在头文件
time.h
中所声明的标准库函数,可以获取当前日期与时间,获取处理器运行
时间,执行日期与时间信息的特定转换,以及实现格式化的输出。一个重要函数为
time()
,它以类型
time_t
的
算术值形式,生成当前的日历时间。它通常是从过去的某
个时间基准点到现在所经过的秒数,这个基准点被称作
epoch
,意思是计算机纪元的开
端。
Unix
的
epoch
是(格林威治标准时间)
1970
年
1
月
1
日
00:00:00
。
还有一些标准函数可以将类型为
time_t
的日历时间转换为一个字符串或一个类型为
struct tm
的结构。该结构类型内包含多个 ...
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