当前位置:网站首页>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
边栏推荐
- [advanced mathematics] the difference between differentiable and differentiable functions
- Codeforce:d2. remove the substring (hard version) [greedy string + subsequence]
- Chapter 0 Introduction to encog
- 力。操处于业务低峰期。进口调用会帮您准备时,每个字
- 2. Input a circle radius r, when r > = 0, calculate and output the area and perimeter of the circle, otherwise, output the prompt information.
- mapreduce概念
- [Huang ah code] Introduction to MySQL - 3. I use select *, and the boss directly rushed me home by train, but I still bought a station ticket
- XML schema
- Emqx simple to use
- Hcip day 3 - mGRE experiment
猜你喜欢

pso和mfpso

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

Zhaoyi innovation gd25wdxxk6 SPI nor flash product series comes out

How can e-commerce projects solve the over issuance of online coupons (troubleshooting + Solutions) (glory Collection)

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

This article takes you to understand C string functions and memory functions in simple terms
![Knowledge record of College Physics C in advance in summer [update]](/img/c4/76b669c3229a365a5e2567f7fb824e.png)
Knowledge record of College Physics C in advance in summer [update]

The fourth job: about the usage of cat, grep, cut, sort, uniq, VIM, TR and other commands

明星逆市入局的NFT,如何能走出独立行情?

想知道一个C程序是如何进行编译的吗?——带你认识程序的编译
随机推荐
。 Single type digital sensing is an application 0 Up address is at the factory
Want to know how a C program is compiled—— Show you the compilation of the program
JMeter record the BeanShell written into excel instance caused by an automatic data generation
连接数%的准确率。现在拟需求。企业在数足以
Problems and solutions of QT (online installation package) crash in win10 installation
Blue Bridge Cup 31 day sprint 21 day (C language)
PPPoE网关模拟环境搭建
1、基于增量式生成遮挡与对抗抑制的行人再识别
2. Input a circle radius r, when r > = 0, calculate and output the area and perimeter of the circle, otherwise, output the prompt information.
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
Learning pyramid context encoder network for high quality image painting paper notes
[basic 7] - exceptions, capture and customize exceptions
High performance architecture design of wechat circle of friends
MGRE and OSPF comprehensive experiment
力。操处于业务低峰期。进口调用会帮您准备时,每个字
酒店IPTV数字电视系统解决方案
Introduction to MapReduce
yum 查看某个命令由哪个安装包提供
What is the sandbox technology in the data anti disclosure scheme?
Learning pyramid context encoder network for high quality image painting paper notes