-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpointer.cpp
34 lines (24 loc) · 909 Bytes
/
pointer.cpp
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
#include <iostream>
using namespace std;
int main(){
int arr[10]={2,5,6};
//int temp[10];
//int *ptr=&temp[0];
/*cout<<"the address of the first block is :"<<arr<<endl;
cout<<"the adress of the first block is:"<<&arr[0]<<endl;
cout<<"the address of the first block is :"<<*arr<<endl;
cout<<"the address of the first block is :"<<*(arr+1)<<endl;
cout<<"the address of the first block is :"<<sizeof(arr)<<endl;
cout<<"the address of the first block is :"<<sizeof(*ptr)<<endl;
cout<<"the address of the first block is :"<<sizeof(ptr)<<endl;
cout<<"the address of the first block is :"<<sizeof(&ptr[0])<<endl;*/
int pink[7]={1,2,3,4};
// int *ptr= &pink[7];
cout<<pink<<endl;
char ch[6]="absed";
char *p=&ch[0];
cout<<p<<endl;
char temp ='z';
char *ptr=&temp;
cout<<ptr<<endl;
}