It just happens, that at this run, on your system, it had the value of 0. aren't uninitialized variables always 0 in C This code invokes Undefined Behavior (UB), since the variable is used uninitialized. memcpy (clone, buf, strlen (buf)); To make sure there are no uninitialzed 'parts' in buf (or at least not … 1323 ctrl. how to find uninitialized variables in c++ Uninitialized variable behaviour in C++ - newbedev.com undefined. Sometimes we assume that the compiler assigns some value like 0 for int, 0.0 for float etc. As it happens, there is a fairly simple answer. I searched the internet for answer to the same but there were differing 'claims'. If you do a … Answer (1 of 2): In C,C++ uninitialized variable variables contains garbage value but static variables contains default value that is 0,and global variables also initialized with default value 0. If you declare an auto variable (on stack not dynamically allocated) in C and do not provide an initial value, then this variable will have what we call a "garbage value". 9. Que se passe-t-il si vous ne renvoyez pas de valeur en C ++? [PATCH 5.15 000/846] 5.15.17-rc1 review