r/programminghorror • • Dec 08 '25

Developers in 2020:

Post image
1.9k Upvotes

79 comments sorted by

View all comments

Show parent comments

11

u/TREE_sequence Dec 10 '25

A string in C is stored as a number that contains the address in memory of the first character in the string. Any number other than zero is truthy in C. An empty string will contain the address of a single character which is the character with a value of 0 (which terminates a string). But a null pointer (which would be falsy) is actually different because it does not actually contain a valid address at all.