当前位置:网站首页>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
边栏推荐
- 招聘| 嵌入式軟件(单片机)工程师
- JMeter record the BeanShell written into excel instance caused by an automatic data generation
- Teach you how to weld CAD design board bottom (for beginners) graphic tutorial
- Basic knowledge of MySQL database
- How to avoid the most common mistakes when building a knowledge base?
- Chapter 7 other neural network types
- The world's first large aerospace model came out. Wenxin's second supplement "Fuchun Mountain Residence map" is Baidu Pratt Whitney AI's perseverance
- How to solve the engine prompt alias herodb and game engine startup exceptions?
- How can NFT, whose stars enter the market against the market, get out of the independent market?
- This article takes you to understand C string functions and memory functions in simple terms
猜你喜欢

Recursive cascade network: medical image registration based on unsupervised learning

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

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

Problems and solutions of QT (online installation package) crash in win10 installation

Introduction to MapReduce

Mrs +apache Zeppelin makes data analysis more convenient

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

Want to know how a C program is compiled—— Show you the compilation of the program

Kingbase V8R6集群安装部署案例---脚本在线一键缩容

frp内网穿透服务使用
随机推荐
MGRE and OSPF comprehensive experiment
Icml2022 | rock: causal reasoning principle on common sense causality
[database connection] - excerpt from training
C primer plus learning notes - 6. Arrays and pointers
Chapter V communication training
How can NFT, whose stars enter the market against the market, get out of the independent market?
Kingbase V8R6集群安装部署案例---脚本在线一键扩容
Drools 开发决策表
Two methods of modifying configuration files in PHP
Image to image translation with conditional advantageous networks paper notes
Jiang Xingqun, senior vice president of BOE: aiot technology enables enterprise IOT transformation
The x-fkgom supporting the GOM engine key.lic is authorized to start
postgresql:在Docker中运行PostgreSQL + pgAdmin 4
Chapter 0 Introduction to encog
yum 查看某个命令由哪个安装包提供
1. Input a 100 point score from the keyboard and output its grade according to the following principles: score ≥ 90, Grade A; 80 ≤ score < 90, grade B; 70 ≤ score < 80, grade C; 60 ≤ score < 70, grade
Hcip-- review the homework for the next day
What is the sandbox technology in the data anti disclosure scheme?
Redis enhancements
Binary SCA fingerprint extraction black Technology: go language Reverse Technology