-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlab1.c
54 lines (42 loc) · 800 Bytes
/
lab1.c
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
#include<stdio.h>
#include <math.h>
void change(int *p_a)
{
*p_a = 10;
}
void Sorting(int arr[], int n)
{
int l = 0;
int c;
for( int i = 1; i < n; i++)
{
int key = arr[i];
c = i - 1;
while(arr[c] > key && c >= 0)
{
arr[c+1]= arr[c];
c = c -1;
}
arr[c+1] = key;
}
int j = 0;
while( j < n )
{
printf("%ld ", arr[j]);
j++;
}
printf("\n");
return 0;
}
int main(void)
{
int a = 5;
printf("%ld\n",a);
int *p_a = &a;
change(p_a);
printf("%ld\n", a);
int arr[]= {8,2,6,3,4,2,1};
int n = sizeof(arr)/sizeof(arr[0]);
Sorting(arr,n);
return 0;
}