ok did get salems code to work, but is there anyway to get the same thing accomplished within the function?
here is the full function:
Code:
static int valid( char array[], int maxnum )
{
int i = 0, decCount = 0, negCount = 0;
for( i = 0; i < maxnum; i++)
{
if( array[i] == '\n' )
return BOOL_TRUE;
if( array[i] == NULL ) // **THIS IS THE PROBLEM.**
return BOOL_FALSE;
if(( array[i] < '0' || array[i] > '9' ) && array[i] != '.'&& array[i] != '-')
return BOOL_FALSE;
if( array[i] == '-' && i > 0) // '-' can only be first element of array
return BOOL_FALSE;
if( array[i] == '.' )
decCount++;
if( decCount > 1) // only allow 1 decimal
return BOOL_FALSE;
}
return BOOL_TRUE;
}