简单的视见函数,令人发疯的问题
我用的是Ubuntu操作系统,使用GCC编译.
如下代码:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
clock_t s;
int main(int argc, char** argv)
{
again:
printf ("now is : %ld\n", s); //clock_t 是 long类型
sleep (1);
goto again;
return 0;
}
但是输出结果是:
now is : 0
now is : 0
now is : 0
now is : 0
now is : 0
now is : 0
怎么回事呀?