Array 2D

I am receiving a C4700 warning. The C++ program I am building, is suppose to allow user to enter (50)numbers, store in array, calculate the average of numbers in the array, and output the calculate sum and average. It states(succeeded) after compiling, but it will not transverse the array.

//
// Final project Template
// Author: Masquerade1986
// Date Written: April 27, 2011
//

#include <iostream>
using namespace std;

double avg_num (double num[], int i); //Function prototype

int main ()
{
double Average;
double num[50];
int i;
const int terminal_val = -777;

cout << "Enter any 50 positive numbers: " << endl;

for (i=0; i < 50; i++) //For Loop to load array
{
cin >> num[i]; //Populate array
}

Average = avg_num (num,i); // Function Call

//cout << "The total of the numbers in the array is: " << tot_num << endl;
cout << endl;
cout << "The average of the " << i << " numbers in the array is: " << Average<< endl;

return (0);
}

/****************************************************************************/
/* Function to calculate the average of the 10 numbers */
/****************************************************************************/

double avg_num (double num[], int i) //Function Definition
{
double avg_of_num,tot_num;
int j;

for (j=0; j < 50; j++) // For Loop to traverse array and calculate average

{
tot_num = tot_num + j;
while (j >= -777);
}

return (avg_of_num/tot_num); // Return Statement
}

/* End of Function
/****************************************************************************/

What is a C4700 warning? What line is it on?

obligatory link: http://cplusplus.com/forum/articles/40071/#msg216270
Thank you Disch.

The warning is: uninitialized local variable "tot_num"used
unintialized local variable 'avg_of_num' used

It is on the line with the while loop
The other is located on the return
Topic archived. No new replies allowed.