help me to decode this code

This is a discussion on help me to decode this code within the C Programming forums, part of the General Programming Boards category; The code is:
Code:
#include <stdio.h>
void connect();
void disconnect();
void print();
void query();
int countries[100][100];
int main ()
{
...

The problem is that after I enter C and go to the connect procedure. After the connect procedure finishes I want to go back to main again. The first time the program runs it allows me to enter a choice, but however after I enter the choice C and go to the connect procedure and want to return back to main it won't allow me to enter a choice!

You need to put a loop in your main function to repeat the steps of asking what the user wants to do and select the correct function.

[1] Unless you are actually writing the C runtime part that runs before main() - but this is a very specialized thing that most C programmers never ever do in their entire life - in the 15-20 years I've worked in C, and bearing in mind that I have done quite a bit of "low level" & "OS level" programming, I have written code that calls main maybe 3-4 times. I'm only writing this to avoid one of the list pedants from pointing this out. If this makes no sense to you, just ignore it.

I didn't say "for loop", I said "loop", meaning the generic loop construct - this can be done with for, while, do - while or even goto. As to which you choose is up to you - I have my idea of what is best, but I'll leave it to you to decide what type of loop makes most sense [after you've posted something with a working loop, I will reveal what I prefer...].

As to when the loop ends, how about when the user gives "x" as the answer?

yes it print's out an invalid choice right away, after showing all the MAIN MENU and options crap. It says that my choice is empty, a blank space

Almost: it says that your choice is <carriage return> -- because you hit carriage return the last time through the menu. You need to scanf using "\n%c", so that whitespace that's left over will get ignored.

yeah I fixed this problem already. By the way a simple question, what is the code in c that will allows me to print 01 say that if the input is only 1? but it prints 11 or 15 if the input is 11 or 15??

yeah I fixed this problem already. By the way a simple question, what is the code in c that will allows me to print 01 say that if the input is only 1? but it prints 11 or 15 if the input is 11 or 15??

I tried "%2d" but this doesn't work

Well, it works, because %2d means "put this number in a field of size 2". If you want "put this number in a field of size 2 and put zeros in front of it", then you need to use that conversion specifier, which is %02d.

Please, try to indent properly. I completely missed the while loop when scanning the code the first time and thought you might have misplaced a bracket that should have been at global level, but it turns out there was another bracket a little further down with a return, so I thought, what the heck? Is there one too many?
So I looked at the code again and noticed a {, and then I noticed the while.