Well, you should have noticed that (ideally) a shell script starts by specifying which shell (there are several) to use. The default in Linux is normal bash thus
This must be at the start of the very first line (no blanks before)
To see what the parser is doing, make the next line
You should really try out some of the code in those links (inc the Rute tutorial) and forget what you know about C.
Don't try to do it all in one go; get some basic simple stuff working first.
When you've done that, have a go (in stages) at the assignment and come back when you've got some code to show.
Incidentally, cron does not login to your home dir, so
05 00 * * * ./foo1.sh
won't work, you need to specify the complete path eg
05 00 * * * /home/username/foo1.sh