Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- float dot_product(float v1[], float v2[], int length)
- {
- int i;
- float result = 0.0; /* Initialize result to 0.0 */
- for (i = 0; i < length; i++) {
- result += v1[i] * v2[i];
- /* printf ( "%f, ", result); Are you sure you need to print this in the loop */
- }
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement