Results 1 to 3 of 3

Thread: Programs in C

  1. #1
    EvansMitchell is offline Senior Member
    Join Date
    Dec 2009
    Posts
    227
    Rep Power
    3

    Default Programs in C

    Timing programs in C

    I am learning C programming language. I am trying to use the functions get usage or times, or the time command to time my programs. But I am not getting the accurate results for that. Does anybody know how to use Timing programs in C.?? Any help would be highly appreciated.

  2. #2
    RogersNguyen is offline Senior Member
    Join Date
    Dec 2009
    Posts
    227
    Rep Power
    3

    Default

    1)I think that you should learn something basic about the timings that are used in the program. Uses of time functions include:

    1. Time program and function.

    2. Telling the time.

    3. Setting number seeds.

    Basic time functions are prototypes in this manner:

    time_t time (time_t *tloc)
    this command will return the time since 00:00:00 GMT, Jan. 1, 1970,

  3. #3
    MorganCooper is offline Senior Member
    Join Date
    Dec 2009
    Posts
    233
    Rep Power
    3

    Default

    2) I am given that you the simple program that shows s that calling the time function at different moments.

    /* timer.c */
    #include <stdio.h>
    #include <sys/types.h>
    #include <time.h>
    main()
    { int i;
    time_t t1,t2;

    (void) time(&t1);
    for (i=1;i<=250;++i)
    printf(``%d %d %d\n'',i, i*i, i*i*i);
    (void) time(&t2);
    printf(``\n Time to do 250 squares and
    cubes= %d seconds\n'', (int) t2-t1);
    }

Similar Threads

  1. Choice of programs by VPN
    By GonzalezBrown in forum General Internet Terms
    Replies: 2
    Last Post: 02-06-2010, 01:37 PM
  2. Executing Programs using VBS
    By alexis_taylor in forum Programming
    Replies: 0
    Last Post: 01-08-2010, 04:13 PM
  3. Programs and Features
    By jack879 in forum Everything Else
    Replies: 0
    Last Post: 03-24-2009, 07:01 AM
  4. Blocked Programs tab
    By alloy in forum General Internet Terms
    Replies: 0
    Last Post: 03-18-2009, 11:01 AM
  5. Can not Run Programs in XP
    By MACONAQUEA77 in forum Windows XP
    Replies: 0
    Last Post: 02-13-2009, 05:30 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
SEO by SubmitEdge

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48