Latest web development tutorials

C 운동 실시 예 92

고전적인 C 언어의 백가지 경우 고전적인 C 언어의 백가지 경우

제목 : 시간의 함수 예 2

프로그램 분석 : 없음.

소스 코드 :

//  Created by www.w3big.com on 15/11/9.
//  Copyright © 2015年 本教程. All rights reserved.
//

#include <stdio.h>
#include <time.h>

int main()
{
    time_t start,end;
    int i;
    start=time(NULL);
    for(i=0;i<300000;i++)
    {
        printf("\n");  // 返回两个time_t型变量之间的时间间隔
    }
    end=time(NULL);
    
    // 输出执行时间
    printf("时间间隔为 %6.3f\n",difftime(end,start));
}

위의 예제 출력은 실행

时间间隔为  1.000

고전적인 C 언어의 백가지 경우 고전적인 C 언어의 백가지 경우