Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- #include <stdlib.h>
- /* pointer love */
- double entropy (double *p) {
- double v = *p;
- return (log(v)/v*log(v));
- }
- int main() {
- double *i = (double*) malloc(sizeof(double));
- scanf("%d", i);
- printf("%d\n",entropy(i));
- }
Add Comment
Please, Sign In to add comment