forked from Anooppandikashala/youtube_c_tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpointer_example_two.c
More file actions
81 lines (56 loc) · 950 Bytes
/
pointer_example_two.c
File metadata and controls
81 lines (56 loc) · 950 Bytes
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
76
77
78
79
80
81
#include<stdio.h>
void printArithmetic()
{
int *x;
int *y;
int num1=10,num2=20;
x=&num1;
y=&num2;
int res1 = *x + *y ;
int res2 = *x - *y ;
int res3 = *x * *y ;
int res4 = *x / *y ;
printf("%d\n",res1);
printf("%d\n",res2);
printf("%d\n",res3);
printf("%d\n",res4);
}
void intArray()
{
int array[5]={1,2,3,4,5};
int *arrayPtr;
arrayPtr = array;
for(int i=0 ; i<5 ; i++)
{
printf("%d\n",*arrayPtr);
arrayPtr++;
}
}
void charPointerArray()
{
//char array
char name[10] = "ANOOP";
char *ptr = name;
printf("%s",ptr);
char *ptr1 = "ANOOP";
printf("\n%s",ptr1);
}
void Sum(int *x , int *y)
{
printf("Sum : %d",*x + *y);
}
int* larget(int *x , int*y)
{
if(*x > *y)
return x;
else
return y;
}
void main()
{
int num1 = 10;
int num2 = 20;
Sum( &num1, &num2) ;
int * large = larget( &num1, &num2);
printf("\nLarge :%d",*large);
}