[Courses] C Programming For Absolute Beginners, Lesson 5A: All About Functions, Part 2
carla at bratgrrl.com
Thu Apr 5 23:11:22 UTC 2012
On Wednesday, April 04, 2012 09:06:37 PM Leslie wrote:
> On Sun, 2012-04-01 at 22:06 -0700, Carla Schroder wrote:
> > HOMEWORK
> > Take any of these examples and modify them to accept user input, just
> > like we did in our previous lessons. Put as much functionality as
> > possible into separate functions and then call them from main.
> (1) This is a little simple, but here goes:
> #include <stdio.h>
You're stuck in a party theme :D
It compiled and ran on the first try. I figured I might as well make it a big
How many people are you inviting to the party?
You'll need 569 plates, so you'll have a few extra.
You'll need 189 gallons of punch.
You'll need 283 bags of chips.
You'll need 567 funny hats so everyone can have one.
I like this, it's all orderly and you use different types of arithmetic in each
function, which is the kind of thing I like to do for simple demos of
> > Why is it OK to use 'void functionname (void)' for ordinary functions,
> > but not OK to use 'void main (void)' ?
> (3) Regarding the above, I looked at Sachin Divekar's answers and I
> can't improve on them.
ace Linux nerd
author of Linux Cookbook,
Linux Networking Cookbook,
Book of Audacity
More information about the Courses