Movatterモバイル変換


[0]ホーム

URL:


man7.org > Linux >man-pages

Linux/UNIX system programming training


void(3type) — Linux manual page

NAME |SYNOPSIS |DESCRIPTION |VERSIONS |STANDARDS |HISTORY |SEE ALSO |COLOPHON

void(3type)void(3type)

NAME        top

       void - abstract type

SYNOPSIS        top

void *

DESCRIPTION        top

       A pointer to any object type may be converted to a pointer tovoid       and back.  POSIX further requires that any pointer, including       pointers to functions, may be converted to a pointer tovoid and       back.       Conversions from and to any other pointer type are done       implicitly, not requiring casts at all.  Note that this feature       prevents any kind of type checking: the programmer should be       careful not to convert avoid * value to a type incompatible to       that of the underlying data, because that would result in       undefined behavior.       This type is useful in function parameters and return value to       allow passing values of any type.  The function will typically use       some mechanism to know the real type of the data being passed via       a pointer tovoid.       A value of this type can't be dereferenced, as it would give a       value of typevoid, which is not possible.  Likewise, pointer       arithmetic is not possible with this type.  However, in GNU C,       pointer arithmetic is allowed as an extension to the standard;       this is done by treating the size of avoid or of a function as 1.       A consequence of this is thatsizeof is also allowed onvoid and       on function types, and returns 1.Use with printf(3) and scanf(3)       The conversion specifier forvoid * for theprintf(3) and thescanf(3) families of functions isp.

VERSIONS        top

       The POSIX requirement about compatibility betweenvoid * and       function pointers was added in POSIX.1-2008 Technical Corrigendum       1 (2013).

STANDARDS        top

       C11, POSIX.1-2008.

HISTORY        top

       C89, POSIX.1-2001.

SEE ALSO        top

malloc(3),memcmp(3),memcpy(3),memset(3),intptr_t(3type)

COLOPHON        top

       This page is part of theman-pages (Linux kernel and C library       user-space interface documentation) project.  Information about       the project can be found at        ⟨https://www.kernel.org/doc/man-pages/⟩.  If you have a bug report       for this manual page, see       ⟨https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/CONTRIBUTING⟩.       This page was obtained from the tarball man-pages-6.15.tar.gz       fetched from       ⟨https://mirrors.edge.kernel.org/pub/linux/docs/man-pages/⟩ on       2025-08-11.  If you discover any rendering problems in this HTML       version of the page, or you believe there is a better or more up-       to-date source for the page, or you have corrections or       improvements to the information in this COLOPHON (which isnot       part of the original manual page), send a mail to       man-pages@man7.orgLinux man-pages 6.15            2025-05-17void(3type)

Pages that refer to this page:NULL(3const)



HTML rendering created 2025-09-06 byMichael Kerrisk, author ofThe Linux Programming Interface.

For details of in-depthLinux/UNIX system programming training courses that I teach, lookhere.

Hosting byjambit GmbH.

Cover of TLPI


[8]ページ先頭

©2009-2025 Movatter.jp