小编Gab*_*abe的帖子

如何访问时间结构的字段

我正在尝试在struct timeval变量中打印值,如下所示:

int main()  
{  

    struct timeval *cur;  
    do_gettimeofday(cur);  
    printf("Here is the time of day: %ld %ld", cur.tv_sec, cur.tv_usec);  

    return 0;  
}  
Run Code Online (Sandbox Code Playgroud)

我一直收到这个错误:

request for member 'tv_sec' in something not a structure or union.  
request for member 'tv_usec' in something not a structure or union.

我怎样才能解决这个问题?

c linux

4
推荐指数
1
解决办法
2万
查看次数

标签 统计

c ×1

linux ×1