Data structure --- linear table of linked storage

(1) Basic Supplement for Chained Storage

pointer

   definition:

      The pointer is also the memory address . The pointer variable is a variable used to store the memory address . Under the same CPU architecture, the lengthof the storage unit occupied by different types of pointer variables is the same, and the variable storing data is different due to the type of data. The length of storage space occupied is also different. With the pointer, you can operate on the data itself or the address of the variable that stores the data.

Basic operations on pointer variables:

#include <stdio.h>

int  main(){
int a=10;
int *p;//定义指针变量
p=&a;//指针变量指向存放a的地址
printf("%d %d %p %p",a,*p,&a,p);//p:指向存放a的地址  &a:存放a的地址
//  *p:相当于从p那里解开存放的数据,即a;
return 0;
}

Low profile single linked list 

     Establishing a linked list is divided into two steps. The first step is to initialize each node object, and the second step is to build a reference point relationship. After completion, you can start from the head node of the linked list (that is, the first node) and  next visit all nodes in turn through pointers.

#include <stdio.h>

typedef struct Node{
    int data;//数据 
    struct Node* next;//指针:指向后续结点
}

int main(){
    Node 

Guess you like

Origin blog.csdn.net/qq_63976098/article/details/131848196