#include #include char *undef; char *def_empty = ""; char *def = "foo bar"; void check(char *t) { if (t) { if (strlen(t)) { printf("Defined loc=%p, val='%s'\n", t, t); } else { printf("Empty string: loc=%p\n", t); } } else { printf("Undefined (null ptr)\n"); } } int main(int, char **) { check(undef); check(def_empty); check(def); return 0; } #### $ ./a.exe Undefined (null ptr) Empty string: loc=0x4020e5 Defined loc=0x4020e6, val='foo bar'