- #1
Spectre32
- 136
- 0
Ok I am working on making a gambling program, that plays craps. Anyways, I have a question dealing with the basic structure of C. I thought that if you where going to return values, the function had to be something other than void. Well I'm looking through some of my professor past class activites, and he has values being returned but under void: See example
So... I mean values are being returned are they not? Yet this is under a void deceleration. Plus I thought that only one value can be returned.
Code:
void get_d_array( double array[], int *pnumgot )
/*
purpose: get series of type double numbers from user
goal state: return series of numbers in array[]
ruturn number of values entered in *pnumgot
*/
{ // begin get_d_array
// variable declaration
int i; // loop index
// ask user for number of lengths
printf( "\nHow many values do you have to enter? ");
printf( "\nNumber of values must be less than %d", MAXSIZE );
printf( "\n Number of values ==> " );
scanf( "%d", pnumgot );
// get values
for( i = 0; i < *pnumgot; i = i+1 )
{ // begin for
array[i] = 2.0*i+5;
} // end for
} // end get_d_array
So... I mean values are being returned are they not? Yet this is under a void deceleration. Plus I thought that only one value can be returned.
Last edited: