aboutsummaryrefslogtreecommitdiffstats
path: root/doc/manual/example2/function.c
blob: 159ddb7a14bc0434dae1c73dcf222ef2725ee74c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
float process_data(float* data, int n) {
  int i;
  float sum;
  for (i = 0; i < n; i++) {
    sum += data[i];
  }
  return sum;
}

float* global_data;
void set_global_data(float* data) {
  global_data = data;
}

float process_global_data(int n) {
  return process_data(global_data, n);
}