Use of undeclared identifier 'CLK_TCK' on Mac


#include <stdio.h>

#include <time.h>

clock_t start, stop;

int main(){

  start = clock();

  function();

  stop = clock();

  double duration = (stop - start)/CLK_TCK;

  return 0;

}

 

看數據結構算法課程,想在mac上的xcode用CLK_TCK跑跑代碼,結果遇到“Use of undeclared identifier 'CLK_TCK'”。

解決:使用CLOCKS_PER_SEC而不是 CLK_TCK 。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM