-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpointer
More file actions
75 lines (62 loc) · 1.22 KB
/
Copy pathpointer
File metadata and controls
75 lines (62 loc) · 1.22 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include<stdio.h>
// int sum(int *x,int *y){
// *x=10;
// *y=30;
// int c=(*x)+(*y);
// return c;
// }
// int main(){
// int x=5;
// int y=4;
// int data=sum (&x,&y);
// printf("%d",data);
// printf("%d",x+y);
//
// int main() {
// int arr[5]={1,2,3,4,5};
// int *p=arr;
// printf("%d",*(p));
// printf("%d",*(p+1));
// printf("%d",*(p+2));
// }
// int main(){
// int arr[5]={1,2,3,4,5};
// int *p=arr;
// for(int i=0;i<5;i++){
// printf("%d\n",*(p++));
// }
// return 0;
// }
// int swap(int *x, int *y){
// int temp=*x;
// *x=*y;
// *y=temp;
// }
// int main(){
// int x,y;
// printf("entre two numbers");
// scanf("%d %d",&x,&y);
// printf("Before swapping: x=%d,y=%d\n",x,y);
// swap(&x,&y);
// printf("After swapping: x=%d,y=%d\n",x,y);
// return 0;
// }
int arr1[5]={1,2,3,4,5};
int arr2[5]={1,2,3,4,5};
int *p1=arr1;
int *p2=arr2;
int flag=1;
for(int i=0;i<5;i++){
if(*(p1+i)!=*(p2+i)){
flag=0;
break;
}
}
if(flag==1){
printf("array are same\n");
}
else{
printf(" array are not same\n");
}
return 0;
}