Linux编程出错:
今天写时间编程,测试一个小程序
warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘time_t {aka long int}
编译的时候却报错
warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘time_t {aka long int}
错误分析:%d需要另一个类型的整数,应该是长整型或无符号
粘贴错误指令搜索,发现了解决办法
%md,m为指定的输出字段的宽度。如果数据的位数小于m,则左端补以空格,若大于m,则按实际位数输出。

%ld(%mld 也可),输出长整型数据。
u格式符,用来输出unsigned型数据,无符号数,以十进制数形式输出。格式:%u,%mu,%lu都可
解决
warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘time_t {aka long int}

相关文章:

  • 2021-08-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-15
  • 2022-12-23
  • 2021-09-22
猜你喜欢
  • 2021-06-27
  • 2021-07-23
  • 2021-09-26
  • 2021-04-25
  • 2022-12-23
  • 2021-06-12
  • 2021-07-04
相关资源
相似解决方案