void(3type) void(3type)
NAME
void - abstract type
SYNOPSIS
void *
DESCRIPTION
A pointer to any object type may be converted to a pointer to void and
back. POSIX further requires that any pointer, including pointers to
functions, may be converted to a pointer to void 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 a void *
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 mech-
anism to know the real type of the data being passed via a pointer to
void.
A value of this type can't be dereferenced, as it would give a value of
type void, which is not possible. Likewise, pointer arithmetic is not
possible with this type. However, in GNU C, pointer arithmetic is al-
lowed as an extension to the standard; this is done by treating the
size of a void or of a function as 1. A consequence of this is that
sizeof is also allowed on void and on function types, and returns 1.
Use with printf(3) and scanf(3)
The conversion specifier for void * for the printf(3) and the scanf(3)
families of functions is p.
VERSIONS
The POSIX requirement about compatibility between void * and function
pointers was added in POSIX.1-2008 Technical Corrigendum 1 (2013).
STANDARDS
C99 and later; POSIX.1-2001 and later.
SEE ALSO
malloc(3), memcmp(3), memcpy(3), memset(3), intptr_t(3type)
Linux man-pages 6.03 2022-10-30 void(3type)
Czas wygenerowania: 0.00018 sek.
Created with the man page lookup class by Andrew Collington.
Based on a C man page viewer by Vadim Pavlov
Unicode soft-hyphen fix (as used by RedHat) by Dan Edwards
Some optimisations by Eli Argon
Caching idea and code contribution by James Richardson
Copyright © 2003-2025 Linux.pl
Hosted by Hosting Linux.pl