data types+operator precedense and associativity

Upload: beenishyousaf7

Post on 02-Jun-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/10/2019 Data Types+Operator Precedense and Associativity

    1/8

    Different D T TYPES

    Subject OOP

    Submitted TO:

    Prof.Naeem

    Section SE(A)

    Roll No. 13021598-033

    NAME Samman Arooj

  • 8/10/2019 Data Types+Operator Precedense and Associativity

    2/8

    Data Types No.of Bytesint 2

    Short int 2

    Unsigned int 2

    Unsigned long int 4

    Long int 4

  • 8/10/2019 Data Types+Operator Precedense and Associativity

    3/8

    float 4

    Double float 8

    Long double 10

    char 1

    Unsigned char 1

    Signed char 1

    Operator Precedence And Assosiativity

    Operator precedence

    Operator precedence determines the order in which operators are evaluated. Operators

    with higher precedence are evaluated first.

    A common example:

    3 + 4 * 5 // returns 23

    The multiplication operator ("*") has higher precedence than the addition operator ("+") and

    thus will be evaluated first.

    Associativity

  • 8/10/2019 Data Types+Operator Precedense and Associativity

    4/8

    Associativity determines the order in which operators of the same precedence are

    processed. For example, consider an expression:

    a OP b OP c

    Left-associativity (left-to-right) means that it is processed as (a OP b) OP c, while right-associativity (right-to-left) means it is interpreted as a OP (b OP c). Assignment operators are

    right-associative, so you can write:

    a = b = 5;

    with the expected result that a and b get the value 5. This is because the assignment operator

    returns the value that it assigned. First, b is set to 5. Then the a is set to the value of b.

    able

    The following table is ordered from highest (0) to lowest (18) precedence

    Precedence Operator type Associativity Individual operators

    0 grouping n/a ()

    1 member left-to-right .

    *

    ]

    new n/a new ()

    2 function call left-to-right ()

    new right-to-left new

    https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Member_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Member_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Special/newhttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Special/newhttps://developer.mozilla.org/en-US/docs/JavaScript/Guide/Functionshttps://developer.mozilla.org/en-US/docs/JavaScript/Guide/Functionshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Special/newhttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Special/newhttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Special/newhttps://developer.mozilla.org/en-US/docs/JavaScript/Guide/Functionshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Special/newhttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Member_Operators
  • 8/10/2019 Data Types+Operator Precedense and Associativity

    5/8

    3 increment n/a ++

    decrement n/a --

    4 logical-not right-to-left !

    bitwise not right-to-left ~

    unary + right-to-left +

    unary negation right-to-left -

    typeof right-to-left typeof

    void right-to-left void

    delete right-to-left delete

    5 multiplication left-to-right *

    division left-to-right /

    modulus left-to-right %

    6 addition left-to-right +

    subtraction left-to-right -

    7 bitwise shift left-to-right

    >>>

    8 relational left-to-right =

    in left-to-right in

    instanceof left-to-right instanceof

    https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Arithmetic_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Arithmetic_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Arithmetic_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Arithmetic_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Logical_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Logical_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Bitwise_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Bitwise_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Arithmetic_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Arithmetic_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Arithmetic_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Arithmetic_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Special/typeofhttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Special/typeofhttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Special/voidhttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Special/voidhttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Special/deletehttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Special/deletehttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Arithmetic_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Arithmetic_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Arithmetic_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Arithmetic_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Arithmetic_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Arithmetic_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Arithmetic_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Arithmetic_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Arithmetic_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Arithmetic_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Bitwise_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Bitwise_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Comparison_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Comparison_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Special/inhttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Special/inhttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Special/instanceofhttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Special/instanceofhttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Special/instanceofhttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Special/inhttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Comparison_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Bitwise_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Arithmetic_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Arithmetic_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Arithmetic_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Arithmetic_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Arithmetic_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Special/deletehttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Special/voidhttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Special/typeofhttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Arithmetic_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Arithmetic_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Bitwise_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Logical_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Arithmetic_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Arithmetic_Operators
  • 8/10/2019 Data Types+Operator Precedense and Associativity

    6/8

    9 equality left-to-right ==

    !=

    ===

    !==

    10 bitwise-and left-to-right &

    11 bitwise-xor left-to-right ^

    12 bitwise-or left-to-right |

    13 logical-and left-to-right &&

    14 logical-or left-to-right ||

    15 conditional right-to-left ? :

    16 yield right-to-left yield

    17 assignment right-to-left =

    +=

    -=

    *=

    /=

    %=

    =

    >>>=

    &=

    ^=

    |=

    https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Comparison_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Comparison_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Bitwise_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Bitwise_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Bitwise_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Bitwise_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Bitwise_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Bitwise_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Logical_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Logical_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Logical_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Logical_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Special/Conditional_Operatorhttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Special/Conditional_Operatorhttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/yieldhttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/yieldhttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Assignment_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Assignment_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Assignment_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/yieldhttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Special/Conditional_Operatorhttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Logical_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Logical_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Bitwise_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Bitwise_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Bitwise_Operatorshttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Comparison_Operators
  • 8/10/2019 Data Types+Operator Precedense and Associativity

    7/8

    18 comma left-to-right ,

    Operator Precedence

    AssociativityOperators Additional Information

    non-

    associative

    clonenew cloneandnew

    left [ array()

    right ++--

    ~(int)(float)(string)(array)(object)(bool)@

    typesandincrement/decrement

    non-associative

    instanceof types

    right ! logical

    left */% arithmetic

    left +-. arithmeticandstring

    left bitwise

    non-associative

    = comparison

    non-

    associative

    ==!====!== comparison

    left & bitwiseandreferences

    left ^ bitwise

    left | bitwise

    left && logical

    left || logical

    left ? : ternary

    https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Special/Comma_Operatorhttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Special/Comma_Operatorhttp://www.php.net/manual/en/language.oop5.cloning.phphttp://www.php.net/manual/en/language.oop5.cloning.phphttp://www.php.net/manual/en/language.oop5.basic.phphttp://www.php.net/manual/en/language.oop5.basic.phphttp://www.php.net/manual/en/language.oop5.basic.phphttp://www.php.net/manual/en/function.array.phphttp://www.php.net/manual/en/function.array.phphttp://www.php.net/manual/en/language.types.phphttp://www.php.net/manual/en/language.types.phphttp://www.php.net/manual/en/language.operators.increment.phphttp://www.php.net/manual/en/language.operators.increment.phphttp://www.php.net/manual/en/language.operators.increment.phphttp://www.php.net/manual/en/language.types.phphttp://www.php.net/manual/en/language.types.phphttp://www.php.net/manual/en/language.operators.logical.phphttp://www.php.net/manual/en/language.operators.logical.phphttp://www.php.net/manual/en/language.operators.arithmetic.phphttp://www.php.net/manual/en/language.operators.arithmetic.phphttp://www.php.net/manual/en/language.operators.arithmetic.phphttp://www.php.net/manual/en/language.operators.arithmetic.phphttp://www.php.net/manual/en/language.operators.string.phphttp://www.php.net/manual/en/language.operators.string.phphttp://www.php.net/manual/en/language.operators.string.phphttp://www.php.net/manual/en/language.operators.bitwise.phphttp://www.php.net/manual/en/language.operators.bitwise.phphttp://www.php.net/manual/en/language.operators.comparison.phphttp://www.php.net/manual/en/language.operators.comparison.phphttp://www.php.net/manual/en/language.operators.comparison.phphttp://www.php.net/manual/en/language.operators.comparison.phphttp://www.php.net/manual/en/language.operators.bitwise.phphttp://www.php.net/manual/en/language.operators.bitwise.phphttp://www.php.net/manual/en/language.references.phphttp://www.php.net/manual/en/language.references.phphttp://www.php.net/manual/en/language.references.phphttp://www.php.net/manual/en/language.operators.bitwise.phphttp://www.php.net/manual/en/language.operators.bitwise.phphttp://www.php.net/manual/en/language.operators.bitwise.phphttp://www.php.net/manual/en/language.operators.bitwise.phphttp://www.php.net/manual/en/language.operators.logical.phphttp://www.php.net/manual/en/language.operators.logical.phphttp://www.php.net/manual/en/language.operators.logical.phphttp://www.php.net/manual/en/language.operators.logical.phphttp://www.php.net/manual/en/language.operators.comparison.phphttp://www.php.net/manual/en/language.operators.comparison.phphttp://www.php.net/manual/en/language.operators.comparison.phphttp://www.php.net/manual/en/language.operators.logical.phphttp://www.php.net/manual/en/language.operators.logical.phphttp://www.php.net/manual/en/language.operators.bitwise.phphttp://www.php.net/manual/en/language.operators.bitwise.phphttp://www.php.net/manual/en/language.references.phphttp://www.php.net/manual/en/language.operators.bitwise.phphttp://www.php.net/manual/en/language.operators.comparison.phphttp://www.php.net/manual/en/language.operators.comparison.phphttp://www.php.net/manual/en/language.operators.bitwise.phphttp://www.php.net/manual/en/language.operators.string.phphttp://www.php.net/manual/en/language.operators.arithmetic.phphttp://www.php.net/manual/en/language.operators.arithmetic.phphttp://www.php.net/manual/en/language.operators.logical.phphttp://www.php.net/manual/en/language.types.phphttp://www.php.net/manual/en/language.operators.increment.phphttp://www.php.net/manual/en/language.types.phphttp://www.php.net/manual/en/function.array.phphttp://www.php.net/manual/en/language.oop5.basic.phphttp://www.php.net/manual/en/language.oop5.cloning.phphttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Special/Comma_Operator
  • 8/10/2019 Data Types+Operator Precedense and Associativity

    8/8