1. which is best practice

given a main that is the same bar the parameters passed to the function which function is best practice

Code:
```int CountDays( int iNumDays, int *iWeekDay )
{
//declare function variable
int iFirstisSunday = 0;

//test to see if first day of the month is a sunday
if ( *iWeekDay == 1 )
{
//set ifirstissunday to 1
iFirstisSunday = 1;
}

//there are 29 days in four weeks counting the first day as 1 ( 1 + 28 = 29 )
iNumDays -= 29;

//add the remainder of inumdays to i weekday + 1 so iweeday is set to the 1st day of next month
*iWeekDay += ( iNumDays + 1 );

//see  if a new week has started
if ( *iWeekDay > 7 )
{
//subtract 7 from i weekday to get the current day
*iWeekDay -= 7;
}

return iFirstisSunday;
}```
or
Code:
```int CountDays( int iNumDays )
{
//declare function variables
static int iWeekDay = 2; //sun = 1 mon = 2 tues = 3 ....1/1/1900 was a monday
int iFirstisSunday = 0;

//test to see if first day of the month is a sunday
if ( iWeekDay == 1 )
{
//set ifirstissunday to 1
iFirstisSunday = 1;
}

//there are 29 days in four weeks counting the first day as 1 ( 1 + 28 = 29 )
iNumDays -= 29;

//add the remainder of inumdays to i weekday + 1 so iweeday is set to the 1st day of next month
iWeekDay += ( iNumDays + 1 );

//see  if a new week has started
if ( iWeekDay > 7 )
{
//subtract 7 from i weekday to get the current day
iWeekDay -= 7;
}

return iFirstisSunday;
}```
the main doesn't care about the day of the week all the calculation is done in the function

2. The first one is better.

Having hidden statics inside the function means trouble for
- calling the function multiple times between sequence points
- calling the function from multiple threads