相关疑难解决方法(0)

为什么printf具有单个参数(没有转换说明符)?

在我正在阅读的一本书中,写printf了一个单一的参数(没有转换说明符)被弃用了.它建议替代

printf("Hello World!");
Run Code Online (Sandbox Code Playgroud)

puts("Hello World!");
Run Code Online (Sandbox Code Playgroud)

要么

printf("%s", "Hello World!");
Run Code Online (Sandbox Code Playgroud)

谁能告诉我为什么printf("Hello World!");是错的?书中写道它包含漏洞.这些漏洞是什么?

c security printf format-specifiers puts

99
推荐指数
10
解决办法
1万
查看次数

从技术上讲,可变函数如何工作?printf如何工作?

我知道我可以va_arg用来编写自己的可变参数函数,但是可变函数如何在引擎盖下工作,即在汇编指令级别?

例如,如何printf采用可变数量的参数?


*没有例外的规则.没有语言C/C++,但是,这两个问题都可以解答

*注意:最初给出的答案如何输出printf函数可以输出数字中的可变参数?,但它似乎不适用于提问者

c c++ variadic-functions

56
推荐指数
2
解决办法
5342
查看次数

标签 统计

c ×2

c++ ×1

format-specifiers ×1

printf ×1

puts ×1

security ×1

variadic-functions ×1