我正在尝试打印参数变量类型字符串,但我一直坚持这个
尝试_Str[i]在 while 循环中使用as 表达式在srting 内部移动,并且一旦_Str[i] == '\0'返回(-1)定义为EOF之后我们测试'\n' == EOF返回EOF。比切换到下一个变量
int main(int argc, char** argv)
{
ps("test1", "test2");
return 0;
}
Run Code Online (Sandbox Code Playgroud)
#ifndef BASE_H_
#define BASE_H_
#ifndef EOF // (EOF) - End Of File character. (-1)
#define EOF (-1)
#endif// EOF
#include<stdio.h>// Facultatif
#include<stdarg.h>
int ps(const char* , ...); // our function
#endif // BASE_H_
Run Code Online (Sandbox Code Playgroud)
int ps(const char* _Str, ...)
{
int i = 0;
//char* …Run Code Online (Sandbox Code Playgroud)