#include <stdio.h>
typedef char* vay_list;
#define vay_rounded_size(type) \
(((sizeof (type) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
#define vay_start(ap, v) \
((void) (ap = (vay_list) &v + vay_rounded_size (v)))
#define vay_arg(ap, type) \
(ap += vay_rounded_size (type), *((type *)(ap - vay_rounded_size (type))))
#define vay_end(ap) ((void) (ap = 0))
void PrintFloats (int amount, ...)
{
int i;
double vayl;
printf ("Floats passed: ");
vay_list vl;
vay_start(vl,amount);
for (i=0;i<amount;i++)
{
vayl=vay_arg(vl,double);
printf ("\t%.2f",vayl);
}
vay_end(vl);
printf ("\n");
}
int main ()
{
PrintFloats (3,3.14159,2.71828,1.41421);
return 0;
}
分享到:
相关推荐
资源中的串口打印,可用于所有TI系列功能安全类芯片,只需更改串口寄存器的地址即可使用。可用于串口调试。如何配置串口在本人博客中已经讲解,可以参考。
可变参数stdarg.h使用方法(例题) va_list用法 va_start已经 va_end
_mingw_stdarg.h
1)首先在函数里定义一个va_list型的变量,这里是arg_ptr,这个变 量是指向参数的指针. 2)然后用va_start宏初始化变量arg_ptr,这个宏的第二个参数是第 一个可变参数的前一个参数,是一个固定的参数. ...
* <stdarg.h> : Variable Argument Lists * <stddef.h> : Definitions of General Use * <stdio.h> : Input and Output * <stdlib.h> : Utility functions * <string.h> : String functions * <time.h> : Time...
英文版C语言标准库,Word文档 Contents • <assert.h> : Diagnostics • <ctype.h> : Character Class Tests • <errno.h> : Error Codes Reported by (Some) Library Functions • <float.h> : Implementation-...
本篇文章主要介绍了c语言基于stdarg.h的可变参数函数的用法,详细的介绍了可变参数函数的详细用法和源码实例,有兴趣的可以了解一下
Variable Argument Lists: <stdarg.h> Non-local Jumps: <setjmp.h> Signals: <signal.h> Date and Time Functions: <time.h> Implementation-defined Limits: <limits.h> and <float.h> Appendix C: Summary ...
FILES ON DISKS -------------- DISK 1 ------ INSTALL EXE - Install program UNZIP EXE - Decompress .ZIP files README COM - Reads this README CLASSDBL ZIP - BIDSDBL PRJ - Project file for building ...
C语言函数库,包含 C 标准库、IO 函数、字符处理函数、字符串函数、数学函数、时间和日期函数、其它函数等数百个常用的C语言函数,文档中对常用函数库的函数原型、详细功能、使用示例等进行了详细的介绍说明,。...
ISO C标准定义的头文件(24项) <assert.h> 验证程序断言 <complex.h> 支持复数算术运算 <ctype.h> 字符类型 <errno.h> 出错码 ...<signal.h> 信号 <stdarg.h> 可变参数表 <stdbool.h> 布尔类型和值
linux应用程序中常用头文件的介绍 ; <assert.h> 验证程序断言 <cpio.h > cpio归档值 ...<stdarg.h > 可变参数表 <stddef.h > 标准定义 <stdio.h > 标准I/O库 <stdlib.h > 公用函数 <string.h > 字符串操作 ......
7 变长变元表 <stdarg.h> 44 8 非局部跳转 <setjmp.h> . . . . . . . . . . 45 9 信号处理 <signal.h> . . . . . 46 10 日期与时间函数 <time.h> . . . . 48 11 由实现定义的限制 <limits.h> 和 <float.h> . . ....
utils.h中添加头文件#include<stdarg.h> 属性->linker->input附加依赖项修改2.3.1版本opencv的lib库文件。 opencv中tbb.dll需复制重命名为tbb_debug.dll。 另外, 系统的环境变量和VS2008中的关于opencv的设置参考...
可变参数列表是通过宏来实现的,这些宏定义于stdarg.h头文件,它是标准库的一部分。 这个头文件声明的一个va_list的类型,和三个宏va_start,va_arg,va_end。我们可以生明一个va_list类型的变量,配合三个宏使用。...
c语言课程设计_计算器设计 #include <dos.h> /*DOS接口函数*/ #include <math.h> /*数学函数的定义*/ #include <conio.h> /*屏幕操作函数*/ #include <stdio.h> /*I/O函数*/ #include <stdlib.h> /*库函数*/ #...
7.8.7 随机数发生器函数 ...B.7 变量变元表:<stdarg.h> B.8 非局部跳转:<setjmp.h> B.9 信号处理:<signal.h> B.10 日期与时间函数:<time.h> B.11 由实现定义的限制:<limits.h>和 <float.h> 附录C 变更小结
程序源代码:#include "graphics.h"#include "math.h"#include "dos.h"#include "conio.h"#include "stdlib.h"#include "stdio.h"#include "stdarg.h"#define MAXPTS 15#define PI 3.1415926struct PTS {int x,y;...