Join Nostr
2026-02-27 12:30:51 UTC
in reply to

GNU/翠星石 on Nostr: Reid :blobcat_happy: Uninitialized variables in a C function are undefined behavior - ...

Uninitialized variables in a C function are undefined behavior - the compiler can decide to zero the variable, or leave it uninitialized - whichever seems faster - so you should always initialize a variable before using the value.

Variables are only guaranteed to get zerod if those are global variables, like;
#include <stdio.h>
int x;
int main(){

But that's not a good habit to get into - it's better to always initialize variables.