# memset

## memset相关知识

• c语言实现顺序表各个功能操作函数
c语言实现顺序表的操作函数首先，一个顺序表先要用结构体定义 typedef struct Seqlist{ &nbsp; &nbsp;Datatype array[MAX_SIZE]; &nbsp; &nbsp;size_t Size; }Seqlist,*psl; &nbsp; 然后要被初始化，这里用memset来初始化&nbsp;&nbsp;&nbsp;&nbsp;memset(psl-&gt;array,&nbsp;0,&nbsp;MAX_SIZE*sizeof(Datatype)); &nbsp;&nbsp;&nbsp;&nbsp;psl-&gt;Size&nbsp;=&nbsp;0;这里实现一个静态表， 然后就可以扩展它的功能了。 这里用代码大概写一些，把他们接口函数写在Seqlist.h头文件中：#ifndef&nbsp;SEQ_LIST#define&nbsp;SEQ_LIST#define&nbsp;_CRT_SECURE_NO_WARININGS&nbsp;1#include&
• 素数
埃氏筛法#define &nbsp;exp 2.7182818285#define &nbsp;Y 0.57721566490153286060651209#define &nbsp;ln2 0.69314718055995#define &nbsp;ln3 1.0986122886681#define &nbsp;lg2 0.301029995663981#define &nbsp;lg5 0.698970004336018#define &nbsp;ln5 1.6094379124341int prime[N];void pre(){&nbsp; &nbsp; memset(prime,1,sizeof(prime));prime[1]=0;&nbsp; &nbsp; for(int i=2;i&lt;N;i++)&nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; if(prime[i])&nbsp; &nbsp; &nbsp; &nbsp; for(int j=2*i
• 莫比乌斯
#include &lt;cstdio&gt;#include &lt;cstring&gt;#include&lt;iostream&gt;#include &lt;algorithm&gt;using namespace std;typedef long long LL;const int MAXN=100000;bool check[MAXN+10];int prime[MAXN+10];int mu[MAXN+10];void mobi(){&nbsp; &nbsp; memset(check,false,sizeof(check));&nbsp; &nbsp; mu[1] = 1;&nbsp; &nbsp; int tot = 0;&nbsp; &nbsp; for(int i = 2; i &lt;= MAXN; i++)&nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; if( !check[i] )&nbsp; &nbsp; &nbsp; &nbsp; {&
• DFS序,欧拉序
#include&lt;bits/stdc++.h&gt;using namespace std;using ll=long long ;using ull=unsigned long long ;#define me(a) memset(a,0,sizeof(a));const int N=10005;vector&lt;int&gt;g[N];int num[N],dis[N],len,t;int s[N],e[N];int euler[N];// void dfs(int u,int x,int pos) // dfs序 时间戳// {// &nbsp;num[++len]=u;// &nbsp; &nbsp; &nbsp; &nbsp;int d=len;// &nbsp;s[len]=++t;// &nbsp;dis[u]=pos;// &nbsp;for(int i:g[u])// &nbsp;{// &nbsp; &nbsp; &nbsp;if(i!=x)// &nbsp; &nbsp; &n