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
๐ŸŒ
Cplusplus
cplusplus.com โ€บ forum โ€บ beginner โ€บ 248142
Is there problem to declare an empty cha - C++ Forum
In other words, yes everything about char c[] = ""; is a "potential hazard". Just do char c = '\0'; if you want to store a null character, because that's essentially all you're doing. ... smoothly, and doesn't crash until the end of the program. Also, the crash can be bypassed by using exit().
๐ŸŒ
C For Dummies
c-for-dummies.com โ€บ blog
Null Versus Empty Strings | C For Dummies Blog
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.
๐ŸŒ
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.
๐ŸŒ
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
Answer (1 of 8): An empty string in C - meaning one that would be a legal-formed string that would be regarded as a string of zero-length by the string.h string functions and other functions that operate on strings - is simply [code ]""[/code]. It is an array of [code ]char [/code]with a element,...
๐ŸŒ
Cplusplus
cplusplus.com โ€บ reference โ€บ cctype โ€บ isblank
Cplusplus
Checks whether c is a blank character. A blank character is a space character used to separate words within a line of text. The standard "C" locale considers blank characters the tab character ('\t') and the space character (' '). Other locales may consider blank a different selection of ...
Find elsewhere
๐ŸŒ
Empty Character
emptycharacter.com
Empty Characters, Whitespaces & Blank Unicode Characters
Empty characters, blank characters, invisible characters and whitespace characters. They look like a space, but are in fact a different (unicode) character. They can be used if you want to represent an empty space without using space. Let's say you want to use an empty value in a website or application, but spaces are not accepted.
๐ŸŒ
LinuxQuestions.org
linuxquestions.org โ€บ questions โ€บ programming-9 โ€บ how-to-return-empty-char-*-750700
How to return empty char * ?
Hi: Here is my code: Code: char * func1(){ ... ... return ""; } This code give me warning "deprecated convertion from string to char *
๐ŸŒ
DaniWeb
daniweb.com โ€บ programming โ€บ software-development โ€บ threads โ€บ 242081 โ€บ error-c2137-empty-character-constant
c++ - Error C2137: Empty Character Constant? | DaniWeb
The compiler error comes from the use of '': C/C++ does not allow an empty character literal. A character literal must contain exactly one character (e.g. 'a') and a string literal ("") is an array/type incompatible with char.
๐ŸŒ
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...
๐ŸŒ
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โ€ฆ