Returns a nonzero integer if the argument is any lower- or uppercase letter or 0-9 digit. Otherwise, it returns the integer 0.
Thursday, March 6, 2014
What is BUFSIZ?
BUFSIZ is a constant macro representing the size of the input buffer. It is defined in stdio.h and represents the size for your C implementation. ANSI C requires that it be at least 256 bytes. A common size is 512. It gives us the maximum number of characters that can be transferred through our standard input stream, stdin.
Thursday, January 12, 2012
What would be the result of the expression -6/5?
The ANSI C standard says that the result is "implementation defined." This means that ANSI C has no hard and fast rule, therefore, the result depends on the compiler that you use. Check your compiler; it should give either -1 or -2 as a result.
Note that the "correct" answer is -1.2. The compiler therefore has a choice of rounding up or down.
Note that the "correct" answer is -1.2. The compiler therefore has a choice of rounding up or down.
Wednesday, January 11, 2012
What happens if we try to assign an integer type value to a float type variable?
C puts a decimal point at the end and converts the method of storage to exponential binary form and store the result in the variable's memory cell. Thus,
p = 6/4;
takes the integer value (6/4, which becomes 1 due to the cutting off of the fractional part), converts this to 1.0 (with a decimal point meaning it is in exponential binary form), and stores this in the memory cell for the variable.
p = 6/4;
takes the integer value (6/4, which becomes 1 due to the cutting off of the fractional part), converts this to 1.0 (with a decimal point meaning it is in exponential binary form), and stores this in the memory cell for the variable.
Subscribe to:
Posts (Atom)