Learn C
#include "advanced/c23.h"

C23: nullptr, constexpr, typeof & #embed in C

#concept

C23 is the biggest modernization since C99: nullptr ends NULL-macro ambiguity (a real null pointer constant), constexpr brings compile-time constants, typeof enables type-safe generic macros, and #embed includes binary resources as byte arrays at compile time. bool, true, and false are finally keywords β€” no stdbool.h required.

Also arriving: [[attributes]] with standard spellings ([[deprecated]], [[fallthrough]], [[maybe_unused]]), decimal-free bit-precise _BitInt, and printf %b for binary. Adoption is ramping (GCC 14+/Clang 17+ lead); -std=c23 plus feature checks (__STDC_VERSION__ >= 202311L) gate usage per toolchain.

#how it works
1

nullptr ends NULL confusion

A real null-pointer constant with pointer type β€” no more 0-vs-(void*)0 ambiguity in overload-free C, just clarity.

2

constexpr and typeof

Compile-time constants plus type queries make generic macros (min/max/clamp) safe without _Generic boilerplate.

3

#embed resources

static const unsigned char blob[] = { #embed "data.bin" }; β€” binary assets compiled in, no xxd step.

4

Gate on versions

#if __STDC_VERSION__ >= 202311L β€” portable code probes the standard before using its newest words.

#example
#include <stdio.h>
Β 
int main(void) {
int *p = nullptr;
constexpr int limit = 100;
typeof(limit) doubled = limit * 2;
printf("%d %d\n", p == nullptr, doubled);
return 0;
}
Output
1 200
1nullptr initializes the pointer with a first-class null constant β€” no macro, no zero pun.
2constexpr fixes limit at compile time; typeof mirrors its type onto doubled without restating int.
3Null comparison true (1), doubled 200 β€” three C23 features cooperating in six lines.
#use cases
nullptr replacing every NULL in new C23 code
Compile-time limits and sizes via constexpr
Type-generic helpers with typeof instead of _Generic scaffolding
Embedding binary assets with #embed, version-gated per toolchain

Recommended resourcesAffiliate links Β· may earn us a commission

Recommended for learners

Structured coding coursesVideo courses that pair well with visual practice β€” pick one language and go deep.Browse courses Pro code editor & AI assistantWrite, debug and explain code faster while you practice the patterns here.Try it free Classic DSA interview booksThe reference books interviewers themselves learned from β€” great next to the visualizers.See the books

Practice what you learned

Re-implement each visualized algorithm in C yourself β€” building beats watching.