-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfp.cpp
More file actions
60 lines (31 loc) · 690 Bytes
/
Copy pathfp.cpp
File metadata and controls
60 lines (31 loc) · 690 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
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int sum (int *a, int n){
int i, sum=0;
for (i=0; i<n; i++)
sum += *(a+i);
return sum;
}
int square (int b){
return b*b;
}
double varSqua (int *a, int n , int (*squ) (int)){
int i;
int b[5];
for (i=0; i<n; i++)
b[i]= (*squ)( a[i]-sum(a,n)/n);
return sqrt((*sum)(b,n));
}
int main (){
double b= 10.0;
void *p = &b;
printf("%d\n", *((int *)p+1));
printf("%f\n", *((double *)p+1));
// p= &b;
//void (*f)(int);
//f= □
int a[5]={1,2,3,4,5};
printf("%d\n",varSqua(a,5, &square));
system("pause");
}