আরো বিভিন্ন Operators সমূহ

Submitted by administrator on Mon, 01/02/2012 - 15:35

CLASS 8 - More Operators

 

In Chapter 6, "Manipulating Data with Operators," you learned about some important operators in C, such as the arithmetic assignment operators, the unary minus operator, the increment and decrement operators, and the relational operators. In this lesson you'll learn about more operators, including

    The sizeof operator
    Logical operators
    Bit-manipulation operators
    The conditional operator

 

 

Summary

In this lesson you've learned the following:

  •     The sizeof operator returns the number of bytes that a specified data type can have. You can use the operator to measure the size of a data type on your machine.
  •     The logical AND operator (&&) returns 1 only if both its two operands (that is, expressions) are TRUE. Otherwise, the operator returns 0.
  •     The logical OR operator (||) returns 0 only if both its two operands are FALSE. Otherwise, the operator returns 1.
  •     The logical negation operator (!) reverses the logical value of its operand.
  •     There are six bit-manipulation operators: the bitwise AND operator (&), the bitwise OR operator (|), the bitwise XOR operator (^), the bitwise complement operator (~), the right-shift operator (>>), and the left-shift operator (<<).
  •     The conditional operator (?:) is the only operator in C that can take three operands.



 

Related Items

The #define and #undef Directives

The #define and #undef Directives

The #define directive is the most common preprocessor directive, which tells the preprocessor to replace every occurrence of a particular character string (that is, a macro name) with a specified value (that is, a macro body).

The C Preprocessor Versus the Compiler

The C Preprocessor Versus the Compiler

One important thing you need to remember is that the C preprocessor is not part of the C compiler.

What Is the C Preprocessor?

If there is a constant appearing in several places in your program, it's a good idea to associate a symbolic name to the constant, and then use the symbolic name to replace the constant throughout the program. There are two advantages to doing so. First, your program will be more readable.

Exercises : Answer the following Question

To help solidify your understanding of this hour's lesson, you are encouraged to answer the quiz questions and finish the exercises provided in the Workshop before you move to the next lesson.

Question and Answer

    Q Why is random access to a disk file necessary?