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

I need app design team wanted to new check-in app, New App Production compa...

New App Production company is seeking an organized and highly accomplished design team to prepare the first (and potentially more) of my companies' App concepts, intended completel

The Shell or Command Line Interpreter is the fundamental Use, 1. The shell ...

1. The shell must support the following internal commands: i. cd - Change the current default directory to . If the argument is not present, report the current directory. If t

Using functions create a program, In rPeANUt implement the "char getchar()"...

In rPeANUt implement the "char getchar()" and "void printstring(char *str)" functions. Using these functions implement the following: void main() {    while (1) {       ch

Graphical user interface designed for the output peripherals, Introduction ...

Introduction to I/O interfacing, discuss microcontrollers applications in industry. Detailed product design specifications that have sections on both hardware and software inclu

Need cron job parsing json from api, Need Cron Job Parsing JSON from API, I...

Need Cron Job Parsing JSON from API, Inserting in to DB Project Description: The Project is to prepare a Cron Job with an adjustable interval in seconds and milli seconds. Cr

Array, how to use nested loop of for in array

how to use nested loop of for in array

Student, Ask4. Write a query to display the columns listed below. The query...

Ask4. Write a query to display the columns listed below. The query should list each customer in which the video rental is overdue. The Days_Overdue column should calculate the numb

Integral, Write a program to find the area under the curve y = f(x) between...

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b

Program is to define a class as teacher, Program is to define a class as te...

Program is to define a class as teacher: Program is to define a class as teacher and collect information about them by using classes and object class teacher   {   pr

After p = new fred[n], After p = new Fred[n], how does the compiler know ab...

After p = new Fred[n], how does the compiler know about n objects to be destructed throughout delete[] p? A:  The run-time system hold the number of objects, n, somewhere where

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