响水凹

欢迎来到 Guang-Wen Duan (Dennis Duan) 的个人 Wiki

用户工具

站点工具


computer:c:tips:void

void的用法

1. 作为函数的返回类型,表示函数没有返回值。如:

void scm_detach_fds_compat(struct msghdr *kmsg, struct scm_cookie *scm);

2. 用在强制转换(cast)表达式中,表示丢弃该值。如:

(void) printf("hello, world\n");

3. 构成void *指针。如:

void *p = NULL;

4. 用于函数参数列表,表示函数没有参数。如:

int main(void)
computer/c/tips/void.txt · 最后更改: 2014/11/01 02:02 由 127.0.0.1