Sponsored Content
Full Discussion: please help with C
Top Forums Programming please help with C Post 302494437 by JohnGraham on Monday 7th of February 2011 10:15:07 AM
Old 02-07-2011
Quote:
Originally Posted by ra2000
the output is T T, but since a macro is defined, i thought it would be t t
It seems you were expecting 'T' to get transformed into 't'. This doesn't happen because nothing inside a character constant or string constant is changed by the preprocessor.


Quote:
Originally Posted by ra2000
the output is 1 1 but the condition is false, so why this output?
The condition "a = 0; ++a == 0" is false - but remember the increment will still happen. Then, because the first condition is false, the second one needs to be tested to see if the whole statement is true or false. Whatever the truth value of the second part, the increment to b still happens because it's evaluated.
 
IS_STRING(3)								 1							      IS_STRING(3)

is_string - Find whether the type of a variable is string

SYNOPSIS
bool is_string (mixed $var) DESCRIPTION
Finds whether the type given variable is string. PARAMETERS
o $var - The variable being evaluated. RETURN VALUES
Returns TRUE if $var is of type string, FALSE otherwise. EXAMPLES
Example #1 is_string(3) example <?php $values = array(false, true, null, 'abc', '23', 23, '23.5', 23.5, '', ' ', '0', 0); foreach ($values as $value) { echo "is_string("; var_export($value); echo ") = "; echo var_dump(is_string($value)); } ?> The above example will output: is_string(false) = bool(false) is_string(true) = bool(false) is_string(NULL) = bool(false) is_string('abc') = bool(true) is_string('23') = bool(true) is_string(23) = bool(false) is_string('23.5') = bool(true) is_string(23.5) = bool(false) is_string('') = bool(true) is_string(' ') = bool(true) is_string('0') = bool(true) is_string(0) = bool(false) SEE ALSO
is_float(3), is_int(3), is_bool(3), is_object(3), is_array(3). PHP Documentation Group IS_STRING(3)
All times are GMT -4. The time now is 11:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy