You can use c[i]= '\0' or simply c[i] = (char) 0.

The null/empty char is simply a value of zero, but can also be represented as a character with an escaped zero.

Answer from ardent on Stack Overflow
๐ŸŒ
Quora
quora.com โ€บ How-do-you-initialize-char*-to-an-empty-string-in-C
How to initialize char* to an empty string in C - Quora
An empty string in C - meaning ... simply "". It is an array of char with a element, and the value of that element is (char) 0 or '\0';...
Discussions

Is there problem to declare an empty char array?
I'm confused. Somebody declares array as char c[1024];. But I found the compiler does not stop me and there's no error after I've declared the array with char c[] = "";. Is there actually any potential problems if I do it this way? ... This does not declare an empty array. More on cplusplus.com
๐ŸŒ cplusplus.com
December 28, 2018
Replace char in C (including empty char)
Find answers to Replace char in C (including empty char) from the expert community at Experts Exchange More on experts-exchange.com
๐ŸŒ experts-exchange.com
March 28, 2011
Empty character constant in C++ - Stack Overflow
I copied this code from a tutorial to play around with. However, I kept on getting an error that stated that I can't have any empty character constants. More on stackoverflow.com
๐ŸŒ stackoverflow.com
Empty value detection for char* type variable
Hi all, I just simply want to detect ...("Something is wrong!!!!"); } But it will alwasy print "okay". What's happening now here? What is the correct way to detect an empty char* variable?... More on forum.arduino.cc
๐ŸŒ forum.arduino.cc
1
0
September 20, 2022
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ c language โ€บ how-to-empty-a-char-array-in-c
How to Empty a Char Array in C? - GeeksforGeeks
July 23, 2025 - We can empty a char array in C by setting all of the elements to โ€˜\0โ€™. So, we can change every index element to '\0', as the first element is '\0' so the char array[] will be treated as empty.
๐ŸŒ
Cplusplus
cplusplus.com โ€บ forum โ€บ beginner โ€บ 248142
Is there problem to declare an empty char array?
December 28, 2018 - It declares an array that is big enough to hold the empty string, which requires one character because strings need to end with a null character '\0'. ... Why are cstrings null terminated? What's the point for terminating with null? consider initializing like this: char c[20] = { '1', '2' }; There's no null terminating character in c[20] but what consequences can I come across?
๐ŸŒ
C For Dummies
c-for-dummies.com โ€บ blog
Null Versus Empty Strings | C For Dummies Blog
August 12, 2017 - An empty string has a single element, the null character, '\0'. Thatโ€™s still a character, and the string has a length of zero, but itโ€™s not the same as a null string, which has no characters at all.
๐ŸŒ
Experts Exchange
experts-exchange.com โ€บ questions โ€บ 26916639 โ€บ Replace-char-in-C-including-empty-char.html
Solved: Replace char in C (including empty char) | Experts Exchange
March 28, 2011 - As far as I can see replace_str should be a string and not a single character. So there's a problem in your logic You are always only writing only the 1st character to the new string out_str[j] = *replace_str Is this what you want??
๐ŸŒ
LinuxQuestions.org
linuxquestions.org โ€บ questions โ€บ programming-9 โ€บ how-to-return-empty-char-*-750700
How to return empty char * ?
August 27, 2009 - Hi: Here is my code: Code: char * func1(){ ... ... return ""; } This code give me warning "deprecated convertion from string to char *
Find elsewhere
๐ŸŒ
Arduino Forum
forum.arduino.cc โ€บ projects โ€บ programming
Empty value detection for char* type variable - Programming - Arduino Forum
September 20, 2022 - Hi all, I just simply want to detect whether a char * variable is empty or not. For example, char* token =""; If( token != '\0' ){ Serial.println("okay"); }else{ Serial.println("Something is wrong!!!!"); } But it wiโ€ฆ
๐ŸŒ
Bytes
bytes.com โ€บ home โ€บ forum โ€บ topic
set char to empty - C / C++
November 14, 2005 - You can set the array to an empty (strlen = 0) string by setting test[0] to '\0'. There are several ways to do this: As part of the definition char test[20] = ""; char test[20] = {'\0'}; Via an assignment test[0] = '\0'; Via a function strcpy(test,"") ; memset(test,'\0 ',sizeof test); [color=blue] ...
๐ŸŒ
Cprogramming
cboard.cprogramming.com โ€บ c-programming โ€บ 112370-setting-char-*-null.html
Setting a char * to null
Source code begins with an empty file. -- Tao Te Chip ... Just in order to maintain my image of being a nitpicker: (char *)NULL is the empty string, "\0" is a string of size 0. I think your nitpicking is incorrect: (char*)NULL is a null pointer, but "\0" is an empty string.
๐ŸŒ
Northern Illinois University
faculty.cs.niu.edu โ€บ ~winans โ€บ CS501 โ€บ Notes โ€บ cstrings.html
C Strings
Array elements after the null character are not part of the string, and their contents are irrelevant. A "null string" or "empty string" is a string with a null character as its first character:
๐ŸŒ
Quora
quora.com โ€บ How-do-I-check-if-a-char-array-is-empty
How to check if a char array is empty - Quora
However, if you know that the array is really a C-style char string, which is a null-terminated byte sequence (NTBS), then maybe the condition youโ€™re looking for is simply array[0] == โ€˜\0โ€™? That tests whether the given array represents an empty string (i.e., the first character already terminates the string).
๐ŸŒ
Cplusplus
cplusplus.com โ€บ forum โ€บ beginner โ€บ 21155
How to empty char array - C++ Forum
<<<<<<<<<<<<<<<<<<<Start of Code>>>>>>>>>>>>>>>>> //Test1 char test[] = "naBac a"; str_compare="nABAc A"; compare_strings(test,str_compare); //Test2 test = "aaa"; str_compare = "AAA"; compare_strings(test,str_compare); <<<<<<<<<<<<<<End of Code>>>>>>>>>>>>>>>>>>> I got some errors, basically I had to clear out the char array before reassigning and proceeding with 2nd test case.
๐ŸŒ
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])) ...