answersLogoWhite

0

What is null string?

User Avatar

Anonymous

13y ago
Updated: 8/20/2019

main(){

char str[5]="hello";

if(str==NULL) printf("string null");

else printf("string not null");

}

User Avatar

Wiki User

13y ago

What else can I help you with?

Related Questions

What is is null?

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


Which is a valid declarations of a String?

String s1=null


Is it possible to initialize null character in string?

yes we can initialize null characterfor example syntax :string='\0';


Why do you need a null terminating string at the end of each string?

to indicate end of string


What is the difference between array and string of array?

When we declare an array of characters it has to be terminated by the NULL , but termination by NULL in case of string is automatic.


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 the significance of using Null Terminator in a string?

to indicate end of the 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.


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.


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.


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);


Java null pointer exceptions?

A null pointer exception in java comes when you are trying to perform any action on an object that isnt initialized/has a value i.e., is a NULL Value Ex: private String s; //declare a string if(s.equals("test")){ //do something.. } You will get a null pointer in the if condition because you are checking a value that is null which is not allowed..