no_recur.c

来自「经典c程序900例是很好的参考资料」· C语言 代码 · 共 30 行

C
30
字号
#include <stdio.h>
#include <time.h>

int string_length(const char *str)
 {
   int length = 0;
   
   while (*str++)
     length++;

   return(length);
 }

void main(void)
 {
   long int counter;

   time_t start_time, end_time;

   time(&start_time);

   for (counter = 0; counter < 100000L; counter++)
     string_length("Jamsa's 1001 C/C++ Tips");
     
   time(&end_time);

   printf("Processing time %d\n", end_time - start_time);
 }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?