Last active
July 5, 2016 12:46
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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