C Programming Cheatsheet
Type Attributes
complex float-point
<locale.h> - Category macros
•
HC - Half Complex; 2 byte half-precision complex
<math.h> - Mathematical and trigonometric functions
•
•
GNU-GCC only
float-point
<monetary.h> - Monetary unit string formatting
•
SC - Single Complex; 4 byte single-precision complex
<mqueue.h> - Message queue
•
•
Attributes.html
float-point
<ndbm.h> - NDBM database operations
•
aligned - Set alignment
•
DC - Double Complex; 8 byte double-precision
<net/if.h> - List local network interfaces
•
•
deprecated - Emit warning msg when called
•
complex float-point
<netdb.h> - Translating protocol and hostnames into
•
mode - Set type mode. Example: typedef
XC - Extended Complex; 12 byte extended-precision
numeric addresses
•
•
complex float-point
<netinet/in.h> - Internet protocol and address family
_Complex float
•
TC - Tetra Complex; 16 byte tetra-precision complex
definitions
•
__attribute((mode(TC))) _Complex128;
float-point
<netinet/tcp.h> - Additional TCP control options
•
packed - Members of a struct or union are
•
QQ - Quarter-Fractional; 1-byte
<nl_types.h> - Localization message catalog
•
•
placed to minimize the memory required
HQ - Half-Fractional; 2-byte
functions
•
unused - Inform the compiler that members of
•
SQ - Single-Fractional; 4-byte
<poll.h> - Asynchronous file descriptor multiplexing
•
•
a struct or union may appear unused; i.e. the
DQ - Double-Fractional; 8-byte
<pthread.h> - API for creating and manipulating
•
•
compiler will not issue warnings
TQ - Tetra-Fractional; 16-byte
POSIX threads
•
UQQ - Unsigned Quarter-Fractional; 1-byte
<pwd.h> - passwd and user information access and
Variable Attributes
•
•
UHQ - Unsigned Half-Fractional; 2-byte
control
•
GNU-GCC only
USQ - Unsigned Single-Fractional; 4-byte
<regex.h> - Regular expression matching
•
•
UDQ - Unsigned Double-Fractional; 8-byte
<sched.h> - Execution scheduling
•
•
Attributes.html
UTQ - Unsigned Tetra-Fractional; 16-byte
<search.h> - Search tables
•
•
aligned - Set alignment
•
HA - Half-Accumulator; 2-byte
<semaphore.h> - POSIX semaphores
•
•
common - Place variable in "common"
SA - Single-Accumulator; 4-byte
<setjmp.h> - Stack environment declarations
•
•
•
DA - Double-Accumulator; 8-byte
<signal.h> - Signals
storage; the common section of an object-file
•
•
TA - Tetra-Accumulator; 16-byte
<spawn.h> - Process spawning
•
deprecated - Emit warning msg when called
•
•
UHA - Unsigned Half-Accumulator; 2-byte
<stdarg.h> - Handle Variable Argument List
•
•
nocommon - Allocate space for the variable
•
USA - Unsigned Single-Accumulator; 4-byte
<stdbool.h> - Boolean type and values
•
•
directly
UDA - Unsigned Double-Accumulator; 8-byte
<stddef.h> - Standard Type Definitions
•
•
unused - Inform the compiler that members of
•
UTA - Unsigned Tetra-Accumulator; 16-byte
<stdint.h> - Integer Types
•
•
a struct or union may appear unused, but that is
CC - Condition Code
<stdio.h> - Standard Buffered I/O
•
•
fine; i.e. the compiler will not issue warnings
BLK - Block
<stdlib.h> - Standard Library Definitions
•
•
vector_size - Set the variable's size in bytes
VOID - Void
<string.h> - Several String Operations
•
•
•
P - Address mode
<strings.h> - Case-insensitive string comparisons
and then divide it into parts; A size of 4 and a type
•
•
V4SI - Vector; 4 single integers
<stropts.h> - Stream manipulation and ioctl
•
•
of "char" would make the variable contain four
V8QI - Vector; 8 single-byte integers
<sys/ipc.h> - Inter-process communication (IPC)
•
•
"char" values
BND32 - 32-bit pointer bound
<sys/mman.h> - Memory management, POSIX
•
•
Special Macros and Keywords
BND64 - 32-bit pointer bound
Shared Memory, and Memory-mapped files
•
__asm__ - Inline assembly code
<sys/msg.h> - POSIX message queues
•
•
<sys/resource.h> - Resource usage, priorities, and
Printing Width-based Integrals
__attribute__ - Function attribute
•
•
limiting
__auto_type - Duck typing
•
Datatype
Print Macros
<sys/select.h> - Synchronous I/O multiplexing
•
__extension__ - Inform compiler that the
•
<sys/sem.h> - XSI (SysV style) semaphores
•
following code is a GCC extension
int8_t
PRId8
<sys/shm.h> - XSI (SysV style) Shared Memory
•
_Generic - Type-polymorphism mechanism
•
<sys/socket.h> - Main Berkley sockets header
•
uint8_t
PRIu8
__GNUC__ - GNU-GCC compiler
<sys/stat.h> - File information
•
•
__label__ - Create a local label by declaring it
int16_t
PRId16
<sys/statvfs.h> - Filesystem information
•
•
<sys/time.h> - Time and date functions and structures
in the beginning of the scope (__label__ label;);
•
uint16_t
PRIu16
<sys/times.h> - File access and modification times
then, place the actual label where needed (label:;)
•
<sys/types.h> - Various data-types
•
uint64_t
PRIu64
__restrict__ - There is only one pointer to the
•
<sys/uio.h> - Vectored I/O operations
•
referenced object; Example: int FUNC(char
intmax_t
PRIdMAX
<sys/un.h> - Unix domain sockets
•
*__restrict__ DATA) {}
<sys/utsname.h> - Operating system info and uname
•
int_least32_t
PRIdLEAST32
<sys/wait.h> - Status of terminated child processes
•
&&label - Address of label
<syslog.h> - System error logging
•
u int_fast32_t
PRIuFAST32
typeof(*x) y - Declare y with x's type
<tar.h> - Magic numbers for the tar archive format
•
Machine Modes
intptr_t
PRIdPTR
<termios.h> - Terminal I/O interfaces
•
<tgmath.h> - Type-Generic math macros
•
BI - 1 Bit
Replace "PRI" with "SCN" in scanf()
•
<time.h> - Time macros
•
QI - Quarter Integer; 1 byte
C POSIX Library
•
<trace.h> - Tracing of runtime behavior
•
HI - Half Integer; 2 bytes
•
<aio.h> - Asynchronous I/O
•
<ulimit.h> - Resource limiting (DEPRECATED; use
•
PSI - Partial Single Integer; 4 bytes; not all bits used
•
<arpa/inet.h> - Functions for manipulating numeric IP
•
<sys/resource.h>)
SI - Single Integer; 4 bytes
•
addresses (part of Berkeley sockets)
<unistd.h> - Various POSIX functions and constants
•
PDI - Partial Double Integer; 8 bytes; not all bits used
•
<assert.h> - Macros assertions
•
<utime.h> - Inode access and modification times
•
DI - Double Integer; 8 bytes
•
<complex.h> - Arithmetic with complex numbers
•
<utmpx.h> - User accounting database functions
•
TI - Tetra Integer; 16 bytes
•
<cpio.h> - Magic numbers for the cpio archive format
•
<wchar.h> - Wide-Character handling
•
OI - Octa Integer; 32 bytes
•
<dirent.h> - Functions for opening and listing
•
<wctype.h> - Wide-Character classification and
•
QF - Quarter Floating; 1 byte quarter-precision float-
•
directories
mapping utilities
point
<dlfcn.h> - Dynamic linking
•
<wordexp.h> - Word-expansion
•
HF - Half Floating; 2 byte half-precision float-point
•
<errno.h> - Retrieving Error Number
•
TQF - Three Quarter Floating; 3 byte three-quarter-
•
<fcntl.h> - File opening, locking, and other file
•
precision float-point
operations
SF - Single Floating; 4 byte single-precision float-
•
<fenv.h> - Floating-Point environment
•
point
<float.h> - Floating Types
•
DF - Double Floating; 8 byte double-precision float-
•
<fmtmsg.h> - Message display structures
•
point
<fnmatch.h> - Filename matching
•
XF - Extended Floating; 12 byte extended-precision
•
<ftw.h> - File tree traversal
•
float-point
<glob.h> - Pathname pattern-matching (globbing)
•
TF - Tetra Floating; 16 byte tetra-precision float-point
•
<grp.h> - User group information and control
•
CQI - Complex Quarter Integer; 1 byte
•
<iconv.h> - Codeset conversion facility
•
CHI - Complex Half Integer; 2 bytes
•
<inttypes.h> - Fixed-size integer data-types
•
CSI - Complex Single Integer; 4 bytes
•
<iso646.h> - Alternative spellings
•
CDI - Complex Double Integer; 8 bytes
•
<langinfo.h> - Language information constants
•
CTI - Complex Tetra Integer; 16 bytes
•
<libgen.h> - Pathname manipulation
•
COI - Complex Octa Integer; 32 bytes
•
<limits.h> - Implementation-defined constants
•
QC - Quarter Complex; 1 byte quarter-precision
•
Created by Devyn Collier Johnson <DevynCJohnson@Gmail.com> (2017) More cheatsheets at DCJTech.info