Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4611770
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:18:44+00:00 2026-05-22T01:18:44+00:00

(This is NOT a homework help question) I was asked by my professor to

  • 0

(This is NOT a homework help question)

I was asked by my professor to write a simple program for computing the dot product of two linear arrays. That was the easy part, so I thought. When I build and run the program in NetBeans IDE 7.0, my print statement at the end of the function reads:

The dot product is 1246

RUN FAILED (exit value 25, total time: 68ms)

But when I run it in debug mode, my output window shows:

The dot product is 1240

This program serves as a precursor to two other programs I must build on top of it (using Pthreads and OpenMP), so it’s important to me that I get it working correctly and I don’t have any surprise outcomes.

Any help would be appreciated. I just don’t get why this is happening. Everything looks right to me but a new pair of eyes wouldn’t hurt.

#include <stdio.h>
#include <stdlib.h>

#define NN 16  //Len of array

main()
{
    int a[NN], b[NN], iVal, dPro;
    int i;
    iVal = 0;
    for(i=0; i<NN; i++) //Loop for building the arrays
    {
        a[i]=1.0*(i);
        b[i]=1.0*(i);
    }
    for(i=0; i<NN; i++) //Loop for computing the dot product
    {
        dPro += a[i]*b[i];
    }

    printf("The dot product is %d \n", dPro);

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T01:18:45+00:00Added an answer on May 22, 2026 at 1:18 am

    You add values to dPro, but you never set its start value.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Disclaimer: This is for a homework assignment, but the question is not regarding the
This is not homework, I need this for my program :) I ask this
Firstly this is not a homework question. I am practicing my knowledge on java.
My professor asks this question for Homework. Consult a Linux Manual or a Microsoft
I beg pardon for not doing homework on this issue and directly asking question
This one is a case of not doing your homework.:-) Apart from dynamic loading
Sorry for this not being a real question, but Sometime back i remember seeing
This is not exactly a programming question, but it's highly related. We are writing
Before I asked this question I had a look through the search results for
NOTE: THIS IS NOT HOMEWORK IT IS FROM A PRACTICE EXAM GIVEN TO US

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.