---
title: vDSP_vadd
framework: accelerate
role: symbol
role_heading: Function
path: accelerate/vdsp_vadd
---

# vDSP_vadd

Calculates the single-precision element-wise sum of two vectors, using the specified stride.

## Declaration

```occ
extern void vDSP_vadd(const float *__A, vDSP_Stride __IA, const float *__B, vDSP_Stride __IB, float *__C, vDSP_Stride __IC, vDSP_Length __N);
```

## Parameters

- `__A`: The first input vector, A.
- `__IA`: The distance between the elements in the first input vector.
- `__B`: The second input vector, B.
- `__IB`: The distance between the elements in the second input vector.
- `__C`: The output vector, C.
- `__IC`: The distance between the elements in the output vector.
- `__N`: The number of elements that the function processes.

## Mentioned in

Controlling vDSP operations with stride

## Discussion

Discussion This function calculates the sums of the first N elements of input vectors A and B, and writes the result to output vector C.  for (n = 0; n < N; ++n)     C[n] = A[n] + B[n];

The following code shows an example of using this function:     let stride = 1     let count = 5

let a: [Float] = [ 1,  2,  3,  4,  5]     let b: [Float] = [10, 20, 30, 40, 50]

let c = [Float](unsafeUninitializedCapacity: count) {         buffer, initializedCount in                  vDSP_vadd(a, stride,                   b, stride,                   buffer.baseAddress!, stride,                   vDSP_Length(count))                  initializedCount = count     }         // Prints "[11.0, 22.0, 33.0, 44.0, 55.0]".     print(c)

## See Also

### Binary addition operations

- [vDSP_vaddD](accelerate/vdsp_vaddd.md)
