c language

(C language) common character functions and string functions

We all know that there is a header file string.h in C language, but there is no string type in C language. [Strings] are usually placed in constant strings or character arrays. String constants are suitable for string functions that do not modify them. The function prototypes declared in the header file string.h are also …

(C language) common character functions and string functions Read More »

[C language] Detailed preprocessing

Precompiled 1. The translation environment and execution environment of the program 1.1 Translation environment 1.2 Preprocessing -> Compile -> Assemble -> Link 1.3 Operating Environment 2. Detailed preprocessing 2.1 Predefined symbols 2.2 #define 2.3.1 #define definition macro 2.3.2 #define substitution rule 2.3.3 # and ## 2.3.4 Macros with side effects 2.3.5 Macros and functions 2.3 …

[C language] Detailed preprocessing Read More »

Two important properties of pointer types

This issue introduces 🍖The main introduction: how is the pointer type defined, what is the difference from the general type definition, why is it so distinguished, what benefits will it bring, pointer [dereference] and pointer offset operations Deep understanding 👀. Article directory Preface 🍖 Types of pointers 🍖 Dereference of pointers 🍖 Offset of pointer …

Two important properties of pointer types Read More »

Exchange sort, bubble sort, selection sort

Swap sort: void sort(int score[],int n) { int i,j,temp; for(i=0;i<n-1;i++) for(j=i+1;j<n;j++) { if(score[j]<score[i]) { temp=score[i]; score[i]=score[j]; score[j]=temp; } } } [Bubble sort] : void sort(int score[],int n) { int i,j,temp; for(i=0;i<n-1;i++) for(j=0;j<n;j++) { if(score[j+1]<score[j]) { temp=score[j]; score[j]=score[j+1]; score[j+1]=temp; } } } [Selection sort] : void sort(int score[],int n) { int i,j,k,temp; for(i=0;i<n-1;i++) { k=i; for(j=i+1;j<n;j++) …

Exchange sort, bubble sort, selection sort Read More »

Embedded c – first lesson (hex conversion, structure, variable)

Table of contents First, the mutual conversion between 1. Representation 2. Calculation 2. Variables 1. Operator 2. Common variable definitions ​ Several special-defined variables 3. Structure 1. The difference between enumeration and structure 2. Structure definition 3. Use of structure First, the mutual conversion between 1. Representation Binary: 0B Decimal: write numbers directly Hexadecimal: 0X …

Embedded c – first lesson (hex conversion, structure, variable) Read More »