This is an online course? So you're just going through it at your own pace, and nobody's there to talk you through things and teach you more about certain topics?
Might I suggest that you also check out some other tutorials, books, etc. while you're at it. Sometimes you don't really get a concept until it's taught in several different ways. I know that when I was trying to learn object-oriented programming (e.g. stepping up to C++ from C), I just did not get it at all until about the fourth book I read, which wrote about it in a way that finally made sense to me.
It may also be helpful to step back a moment and just think in terms of English. How would YOU write a grid of #'s on paper? Sit down and break it into steps as simply as you can. Write the steps down in plain english. Then you can translate your algorithm "pseudocode" into real C code.
Programming requires a level of thinking that some people pick up right away, and for others it takes a while to get used to thinking in small steps. Writing simple steps can help you think through what you're trying to tell the computer to do. Then, turn it into code, and then YOU step through the code exactly, slowly, using pen and paper, pretending you're the computer, to see if it makes sense.
For example, you want to limit input to a maximum of 40. How would you do this in English? You've actually got two ways you could handle it:
Approach 1:
Ask for a number.
If the number is bigger than 40, then tell the user the number is too big.
Ask again, and keep asking until you get a number that's less than or equal to 40.
(note the words "keep asking until <something>" suggests using a loop... writing the steps in English is a good way to shed light on what your code will end up looking like.)
Approach 2:
Ask for a number.
If the number is bigger than 40, then just cap it at 40 and keep going.
I'll use the Approach 2... the first is left as an exercise to you
kainjow is on the right track, but his example is wrong
So turn that plain english into "pseudo code" (half code, half english)
input(number)
if (number > 40) then set number = 40
Next step, turn that pseudo code into real, compiling, C code.
It sounds tedious, but remember that you are learning several different things all at the same time:
- how programming a computer in general works
- designing an algorithm that correctly solves the problem
- how C syntax works (where to put the {, }, semicolons, brackets, etc)
Breaking it down into steps helps you separate the problems. If you can't keep that straight, then you'll have a very hard time proceeding because you'll be writing valid C code that doesn't solve the problem, or you'll know how to solve the problem but write the wrong code to do it, etc.
With time and practice, the pseudo code will start to form in your head and you'll be able to just write the code. But even the pros will write out pseudocode when implementing complex algorithms, just to make sure they know exactly what they're doing.
Good luck!