We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 203d40c commit f4eee33Copy full SHA for f4eee33
Lecture - 21.cpp
@@ -0,0 +1,35 @@
1
+#include <iostream>
2
+#include <cstring>
3
+using namespace std;
4
+int main()
5
+{
6
+ // problem 1.
7
+ /*int a[10]={0};
8
+ cout<<a[5]<<endl;
9
+
10
+ int b[10]={21}; // method wrong ... and luckily valid for only 0 (zero )
11
+ cout<<b[5]<<endl; */
12
13
+ // problem 2.
14
+ /* int n ; cin>>n;
15
+ int a[n]={0};
16
+ cout<<a[5]<<endl; */
17
18
+ // solution of these problem
19
+ // memset ()
20
+ int n;
21
+ cout<<"Input the size of array"<<endl;
22
+ cin>>n;
23
+ int a[n]; // block name --- a
24
+ memset(a,0 ,sizeof(a)); // value --> 0 & -1
25
+ cout<<a[4]<<endl;
26
27
+ int val[9];
28
+ memset(val, -1 , sizeof(val));
29
+ for(int i=0;i<9;i++)
30
+ {
31
+ cout<<val[i]<<" ";
32
+ }
33
+ cout<<endl;
34
35
+}
0 commit comments