answersLogoWhite

0


Best Answer
yes we can initialize null characterfor example syntax :string='\0';
User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Is it possible to initialize null character in string?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is null character and what is its use in context of string?

null character exists at the end of the string.It denotes the end of it.


A character array terminated with the null character is most correctly called what?

zero-terminated string


What is the difference between null pointer ASCII null character and null string?

A null pointer is a pointer which does not point to any valid memory location, and usually contains the binary value "0" to represent this (this is language dependent). The ASCII null character is a character-sized zero value (in ASCII, it is an unsigned byte with a value of 0), and typically represents the end of a string (esp. as in C and C++). A null string is one that is zero characters of usable string data; in a length-based string, this means the length parameter is set to 0, and in an ASCII null-terminated string, means the first character is set to 0.


What is java string?

array of character data type which is terminated by null character


Why strcat(string'!') not work in C program?

The strcat() function has the following protocol:char* strcat (char* destination, char* source);The function appends the source string to the destination string and returns the destination string.The destination string must be a null-terminated character array of sufficient length to accommodate strlen (source) plus strlen (destination) characters, plus a null-terminator. The existing null-terminator and subsequent characters of destination are overwritten by characters from the source string, up to and including the source string's null-terminator.strcat (string, '!') will not work because '!' is a character literal (ASCII code 33 decimal), not a null-terminated character array. Use "!" instead of '!'.Example:char string[80]; // character arraystrcpy (string, "Hello world");strcat (string, "!");puts (string);

Related questions

Why do you need a terminating null character at the end of the every string in C programming?

Because the null character represents the end of the string.


What is null character and what is its use in context of string?

null character exists at the end of the string.It denotes the end of it.


A character array terminated with the null character is most correctly called what?

zero-terminated string


What is the difference between null pointer ASCII null character and null string?

A null pointer is a pointer which does not point to any valid memory location, and usually contains the binary value "0" to represent this (this is language dependent). The ASCII null character is a character-sized zero value (in ASCII, it is an unsigned byte with a value of 0), and typically represents the end of a string (esp. as in C and C++). A null string is one that is zero characters of usable string data; in a length-based string, this means the length parameter is set to 0, and in an ASCII null-terminated string, means the first character is set to 0.


What is java string?

array of character data type which is terminated by null character


How do you initialize variable?

initialize simple types: int i = 0; initialize objects: Object o = null; (in java)


What ConsoleWriteLine do when NULL character within a string?

it will print nothing on commandline..


Why strcat(string'!') not work in C program?

The strcat() function has the following protocol:char* strcat (char* destination, char* source);The function appends the source string to the destination string and returns the destination string.The destination string must be a null-terminated character array of sufficient length to accommodate strlen (source) plus strlen (destination) characters, plus a null-terminator. The existing null-terminator and subsequent characters of destination are overwritten by characters from the source string, up to and including the source string's null-terminator.strcat (string, '!') will not work because '!' is a character literal (ASCII code 33 decimal), not a null-terminated character array. Use "!" instead of '!'.Example:char string[80]; // character arraystrcpy (string, "Hello world");strcat (string, "!");puts (string);


What symbol or character determines end of string?

In C programming language, a string is an array of characters which is always terminated by a NULL character: '\0'


What is null string?

main(){ char str[5]="hello"; if(str==NULL) printf("string null"); else printf("string not null"); }


How can i check a null at the end of an character array in java?

A character array, by nature, is a primitive-type data array. It can't contain a null value. You cannot cast a char as a null. char[] charArray = {'1','2','s',null}; //this doesn't compile. However, if you have an array of Character objects, then it's possible. Character[] charArray = {'1','2','s',null}; //this DOES compile A proposed algorithm is to initialize a test boolean as false, then use a for loop to iterate through the array. Set the flag to true (and break the loop) based upon whether one of the objects you run into is null. What you do from there is up to what the rest of your code says.


How do you use the strtok function?

strtok sequentially truncate string if delimiter is found. If string is not NULL, the function scans string for the first occurrence of any character included in delimiters. If it is found, the function overwrites the delimiter in string by a null-character and returns a pointer to the token, i.e. the part of the scanned string previous to the delimiter. After a first call to strtok, the function may be called with NULL as string parameter, and it will follow by where the last call to strtok found a delimiter. delimiters may vary from a call to another. Parameters. string Null-terminated string to scan. separator Null-terminated string containing the separators. Return Value. A pointer to the last token found in string. NULL is returned when there are no more tokens to be found. Portability. Defined in ANSI-C.