diff options
Diffstat (limited to 'doc/manual/example2/function.c')
-rw-r--r-- | doc/manual/example2/function.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/doc/manual/example2/function.c b/doc/manual/example2/function.c new file mode 100644 index 0000000..159ddb7 --- /dev/null +++ b/doc/manual/example2/function.c @@ -0,0 +1,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); +} |