
Stack vs Heap Memory in C Explained
See where C variables live: the stack for locals that vanish on return, the heap for data you free yourself. Learn the limits, costs and bugs of each.
Tag
445 posts

See where C variables live: the stack for locals that vanish on return, the heap for data you free yourself. Learn the limits, costs and bugs of each.

Expose an SPI device as /dev/spidevB.C, set mode, speed and word size with ioctl, and run full-duplex transfers with SPI_IOC_MESSAGE in a small C program.

Choose between float and double in C by precision, range, memory, SIMD width and hardware support, with accumulation examples and a decision table.

Read variables in LLDB with frame variable, which reads memory, and expression, which compiles and runs code. Learn which to use, plus formats and structs.

Create a new z/OS dataset in JCL with UNIT, SPACE, DCB and DSORG: primary and secondary space, RECFM and LRECL, and BLKSIZE=0 for the system block size.

Build a small, correct C benchmark harness with clock_gettime(CLOCK_MONOTONIC), a compiler barrier, warm-up, many repetitions and a median in eighty lines.

Turn a Yocto 5.0 image into a flashable SD card image with a boot and a root partition by setting WKS_FILE and IMAGE_FSTYPES for the wic tool.

Load i2c-dev, scan a bus with i2cdetect, read and write registers with i2cget and i2cset, and do the same in C through /dev/i2c-N and ioctl on Linux.

Compare floats in C with an absolute tolerance, a relative tolerance and a ULP distance, see where each fails, and combine them into one safe helper.

Configure clang-format with a .clang-format file, format files and diffs, and fail CI on unformatted code so style discussions end before review.

Set LLDB breakpoints by function, file and line, address or regex, then list, disable, delete, make them conditional or one-shot, and attach commands to them.

Code the JCL DISP parameter with its status, normal and abnormal dispositions for NEW, OLD, SHR and MOD datasets, with the defaults and the job log messages.