Computing.Net > Forums > Programming > loop iterations

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

loop iterations

Reply to Message Icon

Name: saddam (by lurker)
Date: February 11, 2004 at 15:36:35 Pacific
OS: Windows XP
Comment:

Have anyone wondered how many iterations can a forloop run in a second? It does a simple task like:

for(int i = 0; i < some_value; i++)
printf("%d ", i);



Sponsored Link
Ads by Google

Response Number 1
Name: StuartS
Date: February 11, 2004 at 17:16:15 Pacific
Reply:

Time It. Put a GeTickCount API at the beginning. Store the value. Get another one at the end and calculate the difference. The answer is in Milli seconds but will only have an resolution of 15 Milli seconds.

GetTickCount returns the number of milli seconds since the computer was started.

Public Declare Function GetTickCount Lib "kernel32" Alias "GetTickCount" () As Long

Stuart


Stuart


0

Response Number 2
Name: saddam (by lurker)
Date: February 12, 2004 at 00:55:06 Pacific
Reply:

Hi Stuart,

thank you for that (useful?) information. however, that is in VB not C


saddam


0

Response Number 3
Name: StuartS
Date: February 12, 2004 at 01:34:13 Pacific
Reply:

Well try this then:

DWORD GetTickCount( void );


Stuart


Stuart


0

Response Number 4
Name: saddam (by lurker)
Date: February 13, 2004 at 00:52:40 Pacific
Reply:

"at the beginning"

is that before the loop and the end out of the loop or within the loop?


regrd,
saddam


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: loop iterations

Java console help www.computing.net/answers/programming/java-console-help/11555.html

C Programming (strings & functions) www.computing.net/answers/programming/c-programming-strings-amp-functions/5696.html

about characters www.computing.net/answers/programming/about-characters/1517.html