fork download
  1. #include <stdio.h>
  2.  
  3. void add_to_array(int *restrict out, int *restrict rhs, int length) {
  4. for (int i = 0; i < length; i++) {
  5. out[i] += rhs[i];
  6. }
  7. }
  8.  
  9. int main(void) {
  10. int a[] = { 1, 2, 3, 4, 5 };
  11. int b[] = { 5, 6, 7, 8, 9 };
  12.  
  13. add_to_array(a, b, 5);
  14.  
  15. for (int i = 0; i < 5; ++i) {
  16. printf("%d\n", a[i]);
  17. }
  18.  
  19. return 0;
  20. }
  21.  
Success #stdin #stdout 0s 2052KB
stdin
Standard input is empty
stdout
6
8
10
12
14