fork download
  1. #include <stdio.h>
  2.  
  3. void add(int *a, int *b, int *c, int n)
  4. {
  5. for (int i = 0; i < n; i++)
  6. {
  7. c[i] = a[i] + b[i];
  8. }
  9. }
  10.  
  11. int main()
  12. {
  13. int a[] = {1, 2, 3};
  14. int b[] = {4, 5, 6};
  15. int c[3];
  16.  
  17. add(a, b, c, 3);
  18. int i;
  19. for (i = 0; i < 3; i++) {
  20. printf("%d ", c[i]);
  21. }
  22. printf("\n");
  23.  
  24. // your code goes here
  25. return 0;
  26. }
Success #stdin #stdout 0.01s 5272KB
stdin
Standard input is empty
stdout
5 7 9