Saturday, 31 August 2013

Return not returning variable value

Return not returning variable value

I wrote a practice program for my class, and everything in it works except
for returning the value of a variable. My question is, why isn't it
returning the value? Here is sample code I wrote out to avoid having to
copy and paste large parts of code that aren't relevant.
#include <iostream>
using std::cout; using std::cin;
using std::endl; using std::fixed;
#include <iomanip>
using std::setw; using std::setprecision;
int testing();
int main()
{
testing();
return 0;
}
int testing() {
int debtArray[] = {4,5,6,7,9,};
int total = 0;
for(int debt = 0; debt < 5; debt++) {
total += debtArray[debt];
}
return total;
}

No comments:

Post a Comment