File: print_bin_array.c

package info (click to toggle)
libslow5lib 1.3.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 25,280 kB
  • sloc: ansic: 13,123; python: 1,353; sh: 600; makefile: 98; cpp: 40
file content (22 lines) | stat: -rw-r--r-- 358 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <stdio.h>
#include <stdlib.h>

int main(void) {

    float *x = malloc(10 * sizeof *x);
    for (int i = 0; i < 10; ++ i) {
        x[i] = 1162.0f + i;
    }

    int *y = malloc(10 * sizeof *y);
    for (int i = 0; i < 10; ++ i) {
        y[i] = (int) x[i];
    }

    fwrite(y, sizeof *y, 10, stdout); 

    free(x);
    free(y);

    return 0;
}