0% found this document useful (0 votes)
10 views1 page

Operator Priority and Data Types Guide

The document outlines operator priority and associativity in programming, detailing the precedence and direction of various operators. It also explains the difference between counters, which count repetitions, and accumulators, which sum values over repetitions. Additionally, it covers topics such as data types, type conversion, and escape sequences.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views1 page

Operator Priority and Data Types Guide

The document outlines operator priority and associativity in programming, detailing the precedence and direction of various operators. It also explains the difference between counters, which count repetitions, and accumulators, which sum values over repetitions. Additionally, it covers topics such as data types, type conversion, and escape sequences.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

• OPERATOR PRIORITY AND ASSOCIATIVITY

• COUNTERS AND ACCUMULATORS


DIFF BETWEEN SOP AND SOPLN
ESCAPE SEQUENCE
PRIMITIVE AND NON PRIMITIVE DATATYPES
EXAMPLES
SIZE IN BITS AND BYTES
TYPE CONVERSION
********************************************************************
OPERATOR PRIORITY and ASSOCIATIVITY

Operators Precedence Associativity

Parentheses (), [] Left to Right

postfix expr++ (post-increment), expr—( post-decrement) Right to left

++expr (pre-increment) , --expr (pre-decrement) , Right to left


Prefix and
+expr(Unary plus), -expr(Unary minus) , ~ ! (Unary
unary
logical negation), (type) Unary type cast

arithmetic * / % Left to right

arithmetic + - Left to right

< (less than) , > (greater than), <= (less than or equal to) , Left to right
relational
>= (greater than or equal to)

equality = =(equality) != (not equal to) Left to right

logical AND && Left to right

logical OR || Left to right

ternary ?: Right to left

assignment = += -= *= /= %= &= ^= |= <<= >>= >>>= Right to left

Difference between counters and accumulators


To count repetitions, we use a variable called counter. An accumulator is similar to the counter.
It is initialised to zero and is incremented in each repetition with different values. The result is
that the variable accumulates the sum of the values added in each repetition. While they must
have both an initial value and an incremental value

You might also like