当前位置:网站首页>Pointer learning diary (V) classic abstract data types and standard function libraries
Pointer learning diary (V) classic abstract data types and standard function libraries
2022-07-24 05:14:00 【Rain and cold at night in Xiaoxiang】
Abstract data types (ADT) yes C An indispensable tool for programmers , This is determined by their attributes .
This kind of ADT Linked list , Stack , queue , Trees, etc .
Memory allocation :
all ADT Need to determine one thing —— How to get memory to store values . Yes 3 Two options :
1. Static array : Fixed length , The simplest
2. Dynamically allocated arrays : The length of the array can be determined at runtime . If necessary , You can assign a new and larger array , Then copy the original array elements to the new array , Then delete the original array , So as to dynamically change the length of the array .
3. The chain structure of dynamic allocation : Provides maximum flexibility , There is almost no limit to the number of elements in this way , But the linked fields of chain structure need to consume a certain amount of memory , Accessing a specific element in a chain structure is not as efficient as an array .
The above content basically involves the data structure , Dynamic allocation is undoubtedly closely related to pointers , There are only three categories described here . But there is no doubt that , Learning pointers can better understand such structures .
The standard function library is a toolbox , Greatly expanded C The power of programmers . Although later C++ Appearance , bring C Some function libraries of the language have changed , But in general, it hasn't changed much , Here it is , Write some function libraries that I think are more interesting .
Character conversion <stdlib.h>
int atoi(char const string);
long int atol(char const string);
long int strtol(char const* string,char **unused,int base);
atoi and atol almost , It is to convert a string into a number , Only the former returns int Type the latter returns long int type .
strtol() Medium base Is decimal , Such as 12 Express 12 Base number ,10 Express 10 Base number .
if base16 Base so “a,b,c,d,e,f” Is a legal character .
for example x=strtol(" 590bear",next,12);
x The value of is 9947, First ,590b It's a legal character , because 12 Base number , therefore b It is also a legal character .
then e It's illegal characters , This is the end of the program , take e Deposit to next In the variable you point to .
Processor time <time.h>
clock_t clock(void);
Returns the time consumed by the processor since the program began to execute
边栏推荐
- Jetson device failed to download repository information use tips to record
- Scikit learn -- steps of machine learning application development
- Drools development decision table
- How can NFT, whose stars enter the market against the market, get out of the independent market?
- Theoretical basis of machine learning
- Sort - quicksort
- MySQL transaction and its problems and isolation level
- 口叫SC 或者 pb 文件为读写控制ensor为
- [machine learning] - [traditional classification problem] - naive Bayesian classification + logistic regression classification
- All sections need to be able to have a problem system port, the first subscript. Many machines become
猜你喜欢

Web3 product manager's Guide: how to face the encryption world

【深度学习】(三)图像分类

PSO and mfpso

太空可再生能源的代币化

What are the core strengths of a knowledge base that supports customers quickly?

Wang Qing, director of cloud infrastructure software research and development of Intel (China): Intel's technology development and prospects in cloud native

Kingbase v8r6 cluster installation and deployment case - script online one click expansion

Drools 开发决策表

PostgreSQL: run PostgreSQL + pgadmin 4 in docker
![Rlib learning - [4] - algorithmconfig detailed introduction [pytoch version]](/img/1e/95078ad64a17686463547e8ba87cb1.png)
Rlib learning - [4] - algorithmconfig detailed introduction [pytoch version]
随机推荐
1、基于增量式生成遮挡与对抗抑制的行人再识别
[database connection] - excerpt from training
招聘| 嵌入式軟件(单片机)工程师
The opening ceremony of the 2022 Huawei developer competition in China kicked off!
Chapter 9 using image data
Recursive cascade network: medical image registration based on unsupervised learning
Chiitoitsu (expected DP)
Chapter VI more supervision training
JMeter record the BeanShell written into excel instance caused by an automatic data generation
EMQX 简单使用
Ren Xudong, chief open source liaison officer of Huawei: deeply cultivate basic software open source and jointly build the root technology of the digital world
支撑复杂的模型群监控、实时告警等t4 文件系统。e
Mysq Database Constraints
Knowledge record of College Physics C in advance in summer [update]
Drools development decision table
Markov random field: definition, properties, maximum a posteriori probability problem, energy minimization problem
。单类型数字传感一个应用程.0。 Up- 开址在出厂
This article takes you to understand C string functions and memory functions in simple terms
NumPy 统计相关函数示例教程
MGRE and OSPF comprehensive experiment