Check if the first character is '\0'. You should also probably check if your pointer is NULL.

char *c = "";
if ((c != NULL) && (c[0] == '\0')) {
   printf("c is empty\n");
}

You could put both of those checks in a function to make it convenient and easy to reuse.

Edit: In the if statement can be read like this, "If c is not zero and the first character of character array 'c' is not '\0' or zero, then...".

The && simply combines the two conditions. It is basically like saying this:

if (c != NULL) { /* AND (or &&) */
    if (c[0] == '\0') {
        printf("c is empty\n");
    }
}

You may want to get a good C programming book if that is not clear to you. I could recommend a book called "The C Programming Language".

The shortest version equivalent to the above would be:

if (c && !c[0]) {
  printf("c is empty\n");
}
Answer from codemaker on Stack Overflow
🌐
Cprogramming
cboard.cprogramming.com › c-programming › 59741-how-check-if-char*-empty-null.html
How to check if char* is empty or null??
December 14, 2004 - It is only empty if it doesnt contain a character (except \0), if the value is " " then it contains a space, which is a character. Check if its NULL, Empty (only '\0'), if its not either see if it contains other characters besides a white space.
Discussions

How to check if C string is empty - Stack Overflow
Since C-style strings are always terminated with the null character (\0), you can check whether the string is empty by writing ... Note that strcmp returns a nonzero value if the strings are different and 0 if they're the same, so this loop continues to loop until the string is empty. Hope this helps! ... Sign up to request clarification or ... More on stackoverflow.com
🌐 stackoverflow.com
c - Best way to check if a character array is empty - Stack Overflow
The second method would almost ... a null-terminated string is empty, since it involves one read and one comparison. There's certainly nothing wrong with this approach in this case, so you may as well use it. The third method doesn't check whether a character array is empty; ... More on stackoverflow.com
🌐 stackoverflow.com
c - How to properly check for null character - Stack Overflow
Having read through some of the answers to this same question posted on the website, I've found that I apparently have made no mistakes when coding this check up. Never-the-less, I keep getting war... More on stackoverflow.com
🌐 stackoverflow.com
How to know if a char array has a null element in C? - Stack Overflow
Say if I have : unsigned char* str = "k0kg" And 0 is the null element. When I loop through it using a for loop, how do I check if the array has a null? I tried: if (str[1]==0): I also tr... More on stackoverflow.com
🌐 stackoverflow.com
🌐
Sabe
sabe.io › blog › c-check-string-empty
How to Check if a String is Empty in C - Sabe.io
March 19, 2022 - Therefore, if the length of the string is 0, then the first character of the string is a null character. ... CLIKE#include <stdio.h> #include <string.h> int main() { char string[] = ""; if (string[0] == '\0') { printf("String is empty"); } else ...
🌐
Programiz
programiz.com › cpp-programming › library-function › cctype › isblank
C++ isblank() - C++ Standard Library
The isblank() function returns non zero value if ch is a blank character, otherwise returns zero. #include <cctype> #include <iostream> #include <cstring> using namespace std; int main() { char str[] = "Hello, I am here."; int count = 0; for (int i=0; i<=strlen(str); i++) { if (isblank(str[i])) ...
🌐
Cplusplus
cplusplus.com › reference › cctype › isblank
Cplusplus
Character to be checked, casted to an int, or EOF. A value different from zero (i.e., true) if indeed c is a blank character.
🌐
C For Dummies
c-for-dummies.com › blog
Null Versus Empty Strings | C For Dummies Blog
August 12, 2017 - You must compare the two: Create an empty string or null string as a sample, then use the strcmp() function to compare them. A null string compares to another null string, and an empty string to an empty one. #include <stdio.h> #include <string.h> int main() { char empty[5] = { '\0' }; char ...
🌐
Reactgo
reactgo.com › home › how to check if a string is empty in c
How to check if a string is empty in C | Reactgo
March 8, 2023 - To check if a given string is empty or not, we can use the strlen() function in C. The strlen() function takes the string as an argument and returns the total number of characters in a given string, so if that function returns 0 then the given ...
🌐
Quora
quora.com › How-do-I-check-if-a-char-array-is-empty
How to check if a char array is empty - Quora
Answer (1 of 10): Alan gave good answer but let me extend a bit. What empty char array means? Let me use C++ array (vector) class to explain. [code]std::vector String; [/code]In C world this is something like: [code]char* pString = NULL; // non allocated, zero sized array pString = (c...
Find elsewhere
🌐
TutorialKart
tutorialkart.com › c-programming › how-to-check-if-a-string-is-empty-in-c
How to Check if a String is Empty in C - Examples
February 21, 2025 - In this example, we compare the string with an empty string using strcmp() from string.h. ... #include <stdio.h> #include <string.h> int main() { char str[] = ""; // Compare string with an empty string if (strcmp(str, "") == 0) { printf("The string is empty.\n"); } else { printf("The string is not empty.\n"); } return 0; }
🌐
Silicon Cloud
silicloud.com › home › how to determine if a char array is empty in c language?
How to determine if a char array is empty in C language? - Blog - Silicon Cloud
March 28, 2024 - #include <stdio.h> #include <stdbool.h> bool isCharArrayEmpty(char arr[], int size) { for (int i = 0; i < size; i++) { if (arr[i] != '\0') { return false; // 如果数组中有一个元素不是空字符,则返回false } } return true; // 如果数组中所有元素都是空字符,则返回true } int main() { char arr1[] = {'\0', '\0', '\0'}; char arr2[] = {'a', 'b', 'c'}; if (isCharArrayEmpty(arr1, sizeof(arr1)/sizeof(arr1[0]))) { printf("arr1 is empty\n"); } else { printf("arr1 is not empty\n"); } if (isCharArrayEmpty(arr2, sizeof(arr2)/sizeof(arr2[0]))) { printf("arr2 is empty\n"); } else { printf("arr2 is not empty\n"); } return 0; } In the above code, the isCharArrayEmpty function is used to check if a char array is empty.
🌐
DaniWeb
daniweb.com › programming › software-development › threads › 425629 › how-to-check-null-character-in-an-array
java - How to check NULL character in an array [SOLVED] | DaniWeb
June 14, 2012 - In Java char is a 16 bit unsigned numeric value, so zero is perfectly valid anywhere, but the Java equivalent of your loop wold be something like for (int i = 0; my-char-array[i] != 0; i++) {... of course that will give an array index out of bounds if the array … — JamesCherrill 4,733 Jump to Post · I don't think an array of char can have an element that is null.
🌐
Wikihow
wikihow.com › computers and electronics › software › programming › c programming languages › how to check null in c: 7 steps (with pictures) - wikihow
How to Check Null in C: 7 Steps (with Pictures) - wikiHow
June 9, 2025 - It's common practice to set newly created or newly freed pointers to NULL to make sure you don't use this unhelpful address by accident. Avoid this mistake: char *ptr; if(ptr == NULL) { //This will return FALSE.
🌐
GeeksforGeeks
geeksforgeeks.org › c language › difference-between-null-pointer-null-character-0-and-0-in-c-with-examples
Difference between NULL pointer, Null character ('\0') and '0' in C with Examples - GeeksforGeeks
July 15, 2025 - The macro NULL is provided in the header file "stddef.h". Below are the ways to check for a NULL pointer: NULL is defined to compare equal to a null pointer as: ... if(!pointer) Null Characters('\0'): '\0' is defined to be a null character.