Operators and their expression in cpp, C/C++ Programming

Assignment Help:

Operators in C++:

All C operators are valid operators in C++ also.  Besides C++ has developed some new operators like

Operators and their Expression:

1.      Logical operator

2.   Assignment operator: Variable must be declared before assigning. Chain Assignment Ex: x=y=z;

Embedded Assignment Ex: x=(y=10)+10;

Compound or Shorthand Assignment: x = x+y is x +=y; Dynamic initialization Ex: int x=strlen("apple");

Static initialization Ex int x=100;

3.   Reference variable: Ex: int &x=y; x is alias of y.

4.   Relation operator

5. Arithmetic operator

6 Increment and Decrement operator

7 Special operator.

8 Conditional operator.

9 Bitwise operator.

10. Type cast operator: Ex: x =float(a)/float(b).

11. Scope Resolution operator: Ex: :: to access from global variable and class.

12. Insertion and Extraction operator: << and >>.

13. Class Member dereferencing operator:

1 :: To declare pointer to a member in class.

2 ->*  To access pointer member when both class and member have pointers

3 .*     To access pointer member when only member has pointer.

14. Memory  Management  Operator:  new  and  delete.   The  variable  must  be  pointer

variable. In malloc, calloc, realloc, free are used. int *ptr;  ptr = new int;

ptr = new int(25); assigning value delete ptr;  release the memory of ptr.

 

int *ptr; ptr = new int[10];

delete []ptr; release the memory or array pointer.

 

15. Manipulator Ex: endl work like \n and setw(10) set width for the variable cout<<setw(10)<<x<<endl<<setw(10)<<y.

16. Implicit Expression: Conversion is implied from lower to higher order of primary

data type.

17. Operator overloading: Ex: << and >>


Related Discussions:- Operators and their expression in cpp

Single string programme, write a programme that allows a user to enter 5 di...

write a programme that allows a user to enter 5 distinct words and returns them as a single string

multiplication of matrices with compatibility check, Normal 0 ...

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

What is a union how does it differ from a structure, Question : (a) (i)...

Question : (a) (i) What is a structure member in C? What is the relationship between a structure member and the structure? (ii) How can structure variables be declared in C?

Data structures, what are 3 conditions under which the sequential search of...

what are 3 conditions under which the sequential search of a list is preferable to binary search?

Program is to append the contents of one file to another, Program is to app...

Program is to append the contents of one file to another: void main()    {   clrscr();   fstream file1,file2;   char st1[13],st2[13];/* 13 because a filename canno

Program to convert fraction to decimal, Program to convert fraction to deci...

Program to convert fraction to decimal: int main() {                 float num, denom;     // numerator and denominator of fraction                 float value;

Data structure, how to convert a general tree into binary tree with example...

how to convert a general tree into binary tree with example

Inline functions, Inline functions, C++ provides inline functions to help r...

Inline functions, C++ provides inline functions to help reduce function_call overhead especially for small functions. The qualifier inline before function's return type in the f

Board coloring, in this problem u given a board in which some of the eleme...

in this problem u given a board in which some of the elements are placed as shown in diagram below .each element represent a color .fill the other elements in the board such that n

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd