数组初始化 memset fill

 

 1 #include <cstdio>
 2 #include <cstdlib>
 3 #include <cmath>
 4 #include <cstring>
 5 #include <time.h>
 6 #include <string>
 7 #include <set>
 8 #include <map>
 9 #include <list>
10 #include <stack>
11 #include <queue>
12 #include <vector>
13 #include <bitset>
14 #include <ext/rope>
15 #include <algorithm>
16 #include <iostream>
17 using namespace std;
18 #define ll long long
19 #define minv 1e-6
20 #define inf 1e9
21 #define pi 3.1415926536
22 #define nl 2.7182818284
23 const ll mod=1e9+7;//998244353
24 const int maxn=1e2+10;
25 
26 int a[maxn],b[maxn];
27 
28 char c[maxn];
29 
30 int main()
31 {
32     memset(a,0,sizeof(a));
33     fill(b,b+100,inf);
34     fill(c,c+100,'a');
35 
36     cout<<a[1]<<endl;
37     cout<<b[2]<<endl;
38     cout<<c[3]<<endl;
39     return 0;
40 }

 

 

posted @ 2018-08-29 19:52  congmingyige  阅读(144)  评论(0编辑  收藏  举报