代码如下
printf("%d pid : ppid :%d %d\n",s*s,getpid,getppid;

错误如下
warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘__pid_t (*)(void)’
格式’%d’需要类型为’int’的参数,但参数3的类型为’__pid_t(*)(void)’[ - Wformat]

也就是在需要传入参数返回值的时候很重要的一件事,一定要加上括号。
加上括号就是取返回值,不加括号就是一个函数。

正确改为
printf("%d pid : ppid :%d %d\n",s*s,getpid(),getppid());

warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘__pid_t (*)(void)’
开心一点,人间不值得。

相关文章:

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