-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtut13.cpp
More file actions
44 lines (38 loc) · 1.04 KB
/
tut13.cpp
File metadata and controls
44 lines (38 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include<iostream>
using namespace std;
int main()
{
int i=0, marks[5] = {98,94,67,87,76};
cout<<marks[0]<<endl;
cout<<marks[1]<<endl;
cout<<marks[2]<<endl;
cout<<marks[3]<<endl;
cout<<marks[4]<<endl;
// for (int i = 0; i < 5; i++)
// {
// /* code */
// cout<<"The value of marks is :"<<marks[i]<<endl;
// }
// while (i<5)
// {
// /* code */
// cout<<"The value of marks is :"<<marks[i]<<endl;
// i++;
// }
// do
// {
// /* code */
// cout<<"The value of marks is :"<<marks[i]<<endl;
// i++;
// } while (i<5);
// ******pointer and array in cpp****
int *p = marks ;
cout<<*(p++)<<endl;
cout<<*p<<endl;
// cout<<"The value of marks[0] is :"<<*p<<endl;
// cout<<"The value of marks[1] is :"<<*(p+1)<<endl;
// cout<<"The value of marks[2] is :"<<*(p+2)<<endl;
// cout<<"The value of marks[3] is :"<<*(p+3)<<endl;
// cout<<"The value of marks[4] is :"<<*(p+4)<<endl;
return 0;
}