In the current code base I'm looking at there's , at least, these:
if(strlen(str) == 0)if(str[0] != 0)if(!*str)
And similar variants for it being empty/not empty . The first one reads better, but might waste time (which might nor might not matter). And I suppose one could make a #define STR_EMPTY(str) (*(str) == 0) macro.
But anyway, is there a commonly agreed upon way to check if a string is (not) empty in C ?