pass parameter to function

HI all

I have a code like

##############################################

minyear()
{
curryear=$1
echo $curryear
}

##Main Program ##
minyear
exit
#######
when i execute "sh scriptname 2005" output should be like 2005 but the output is blank.
I guess i need to pass parameter to the function. Can you please let me know how to pass parameter from main function and what needs to be done in the function to collect the value

Assuming 'sh scriptname 2005', which means 2005 becomes $1 in your script:

minyear()
{
curryear=$1
echo $curryear
}

##Main Program ##
minyear $1
exit

$ sh scriptname 2005
2005

That will not work if $1 contains spaces. Always quote your variables:

minyear "$1"

A function is called in the same way as any other command and accesses its arguments in the same way ($1, $2, etc.).