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

How do you connect a c++ program to c functions?, A: Using the extern "C" l...

A: Using the extern "C" linkage specification around the C function declarations. Programmers must know about mangled function names and type-safe linkages. After that they must

Write a c++ program that calculates the area of a circle, Write a C++ progr...

Write a C++ program that calculates the area of a circle, rectangle and square using overloaded versions of a function area ().Your program should include both declarations and def

Arrys, Write a program that allows user to enter number of elements in an a...

Write a program that allows user to enter number of elements in an array. The program then allows user to enter the elements. Write a function called max that returns the position

Primary data type in cpp, What are  P r im a r y D a t a T y p...

What are  P r im a r y D a t a T y p es? Integer can be defined according to the size of the data and it can be modified further by using keyword unsigned and si

, print this pattern 1 01 101 010

print this pattern 1 01 101 0101

Miss, Depreciation to a salvage value of 0. For tax purposes an item m...

Depreciation to a salvage value of 0. For tax purposes an item may be depreciated over a period of several years, n. With the straight line method of depreciati

Create program to prints out the value of a variable, Here is a short progr...

Here is a short program. It prints out the value of a variable "x". Ernie and Bert disagree about what will be printed: Ernie says, the value gets changed in "changeX" so it will p

Credit Card Validation Check digit, Use 16 digit credit card numbers that c...

Use 16 digit credit card numbers that contain 15 digits an 1 check digit. The format of the card number consists of the 15 digits followed by the check digit. The check digit is co

Load catalogue from file, Implement a menu driven real estate catalogue sys...

Implement a menu driven real estate catalogue system that allows users to perform various catalogue maintenance and search tasks.  You are only allowed to use the C programming la

Explalin concept of derivations in c++, derivations 1. Regardless of the...

derivations 1. Regardless of the type of derivation, private members are inherited by the derived class, but cannot be accessed by the new member function of the derived class,

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