Skip to content

Instantly share code, notes, and snippets.

@ik5
Last active July 5, 2016 12:46
Show Gist options
  • Save ik5/718bb4604f9284fc81d011c342e48c36 to your computer and use it in GitHub Desktop.
Save ik5/718bb4604f9284fc81d011c342e48c36 to your computer and use it in GitHub Desktop.
example on how to validate if a dynamic array of chars is empty
#include <stdio.h>
#include <string.h>
int empty_string(char * str) {
return(str == NULL || strlen(str) == 0 );
}
int main(int argc, char **argv) {
char * ch = NULL;
printf("empty? %d\n", empty_string(ch));
return(0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment