Quantcast
Channel: '\0' evaluates false, "\0" evaluates true - Stack Overflow
Browsing latest articles
Browse All 10 View Live
↧

Answer by Bhartendu Kumar for '\0' evaluates false, "\0" evaluates true

The simple thing is ATLEAST 0 (int) and 0.0 (float or double) have FALSE value in C.'\0' is integer 0."\0" is an array of characters. It does not matter that INSIDE the array how many Characters are...

View Article


Answer by Krishna for '\0' evaluates false, "\0" evaluates true

Check out this with examples..#include <stdio.h> int main() { printf( "string value\n" ); //the integer zero printf( "0.........%d\n" , 0 ); //the char zero, but chars are very small ints, so it...

View Article

Answer by G.Mather for '\0' evaluates false, "\0" evaluates true

'\0' is a char that is equal to number zero. "\0" is a string and we usually add '\0' at the end of a string. Don't use '\0' or "\0" in a conditional statements because it's quite confusing.The...

View Article

Answer by Bora for '\0' evaluates false, "\0" evaluates true

First of all, please note that the hexadecimal value of False is 0x00 and True is any other value than 0x00."\0" is a string with a character and Null Terminator '\0' at the end. So it is a character...

View Article

Answer by Spikatrix for '\0' evaluates false, "\0" evaluates true

First of all, you need to keep in mind that in C,Zero is false and non-zero is true.For pointer types, NULL is false and non-NULL is true.'\0', as others have said, is the same as the integer literal 0...

View Article


Answer by FedeWar for '\0' evaluates false, "\0" evaluates true

'\0' is a number: 0, so it is evaluated as false (0 = false, !0 = true).But "\0" is a pointer to a read-only section where the actual string is stored, the pointer is not NULL ergo it's true.

View Article

Answer by fluter for '\0' evaluates false, "\0" evaluates true

First, looking at the two conditions, '\0' is a constant of type integer, which denotes the null character C, which is the same as 0. While "\0" is a string literal, which contains 2 bytes, the one...

View Article

Answer by msc for '\0' evaluates false, "\0" evaluates true

'\0' is a null character which has the value of 0. It is used to terminate a string of characters. So it's consider false."\0" is a null or emptystring. The only character in the string is the null...

View Article


Answer by user253751 for '\0' evaluates false, "\0" evaluates true

Recall how string literals work in C - "\0" is a character array containing two zero bytes (the one you asked for, and the implicit one at the end). When evaluated for the if test, it decays into a...

View Article


'\0' evaluates false, "\0" evaluates true

Inspired by a program described in K&R section 5.5:void strcpy(char *s, char *t){ while(*s++ = *t++);}C programif ('\0') { printf("\'\\0\' -> true \n"); }else { printf("\'\\0\' -> false\n");...

View Article
Browsing latest articles
Browse All 10 View Live




<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>