I\'m writing a very small program in C that needs to check if a certain string is empty. For the sake of this question, I\'ve simplified my code:
#include
I've written down this macro
#define IS_EMPTY_STR(X) ( (1 / (sizeof(X[0]) == 1))/*type check*/ && !(X[0])/*content check*/)
so it would be
while (! IS_EMPTY_STR(url));
The benefit in this macro it that it's type-safe. You'll get a compilation error if put in something other than a pointer to char.