goto statement

Mar 5, 2009 at 8:40pm
Hey guys anyone got any idea how to get some kind of counter to count how many times the goto has been used? I'm trying to use my goto; start: function 20 times but cant stop it.

thanks guys
Mar 5, 2009 at 8:58pm
Could you post your code so I can see what you mean?
Mar 5, 2009 at 9:12pm
I think this is in reference to your previous post. You do not need goto.
You never need goto.

1
2
3
int counter = 0;
for( char c = 'A'; c <= 'Z'; ++c )
   ++counter;


counts the number of characters in the alphabet, as an example.

1
2
3
4
5
6
int counter = 0;
char c ='A';
while( c <= 'Z' ) {
   ++c;
   ++counter;
}


does the same thing using a while loop instead.

Topic archived. No new replies allowed.