Misc Operators
The following table lists some other operators that C++ supports.
Description
sizeof sizeof operator returns the size of a variable. For example,
sizeof(a), where ‘a’ is integer, and will return 4.
Condition ? X : Y Conditional operator (?). If Condition is true then
it returns value of X otherwise returns value of Y.
, Comma operator causes a sequence of operations
to be performed. The value of the entire comma expression
is the value of the last expression of the comma-separated list.
. (dot) and -> (arrow) Member operators are used to reference
individual members of classes, structures, and unions.
Cast Casting operators convert one data type
to another. For example, int(2.2000) would return 2.
& Pointer operator ‘&’ returns the address of a variable.
For example &a; will give actual address of the variable.
* Pointer operator * is pointer to a variable. For example *var;
will pointer to a variable var.
No comments:
Post a Comment