Well 'getMonth' from the sound of it, shouldn't be passed anything, especially considering that you're returning one already. Just do:
Code:
int main( void )
{
unsigned int month;
month = getMonth( ); /* call your function, assing the return to 'month' */
... stuff ...
return 0;
}
If you want to pass it, and have that updated, then you'll need to pass a pointer to it:
Code:
void getMonth( unsigned int *month )
{
...fill in month...
}
int main( void )
{
unsigned int month;
getMonth( &month );
... stuff ...
return 0;
}
So in short:
1 - Return it and assign the returned value.
2 - Pass a pointer to it and modify that.
However, if all you want to do is pass the value around, and not change it in the function, then simply pass it like any other variable:
Code:
void printMonth( unsigned int month )
{
... print out the month you pass ...
}
int main( void )
{
unsigned int month;
... stuff ...
printMonth( month );
return 0;
}
Quzah.