How to initialize memory with a new operator in C++?

Nishtha Thakur
Published on 15-Feb-2018 11:33:06
The new operator in C++ is defined for allocating memory and not initializing. If you want to allocate an array of type int with the new operator, and you want to initialize them all to the default value(ie 0 in case of ints), you can use the following syntax:new int[10]();Note ... Read More

What is the difference between the dot (.) operator and -> in C++?

Smita Kapse
Published on 15-Feb-2018 11:17:29
The dot and arrow operator are both used in C++ to access the members of a class. They are just used in different scenarios. In C++, types declared as class, struct, or union are considered "of class type". So the following refers to all three of them.a.b is only used ... Read More

What is C++ Standard Error Stream (cerr)?

Arushi
Published on 15-Feb-2018 11:19:02
std::cerr is an object of class ostream that represents the standard error stream oriented to narrow characters (of type char). It corresponds to the C stream stderr. The standard error stream is a destination of characters determined by the environment. This destination may be shared by more than one standard ... Read More

What are the basic rules and idioms for operator overloading in C++?

Anvi Jain
Published on 15-Feb-2018 11:09:29
When it comes to operator overloading in C++, there are 3 basic rules you should follow. like all such rules, there are so exceptions. These 3 rules are:1.  Whenever the meaning of an operator is not obviously clear and undisputed, it should not be overloaded. Instead, provide a function with ... Read More

Standard Input Stream (cin) in C++

Manikanth Mani
Published on 15-Feb-2018 11:10:10
std::cin is an object of class istream that represents the standard input stream oriented to narrow characters (of type char). It corresponds to the C stream stdin. The standard input stream is a source of characters determined by the environment. It is generally assumed to be input from an external ... Read More

What is the ?-->? operator in C++?

Nitya Raut
Published on 15-Feb-2018 11:03:44
There is no such operator in C++. Sometimes, we need to create wrapper types. For example, types like unique_ptr, shared_ptr, optional and similar. Usually, these types have an accessor member function called .get but they also provide the operator-> to support direct access to the contained value similarly to what ... Read More

What is C++ Standard Output Stream (cout)?

Rishi Raj
Published on 15-Feb-2018 10:55:20
std::cout is an object of class ostream that represents the standard output stream oriented to narrow characters (of type char). It corresponds to the C stream stdout. The standard output stream is the default destination of characters determined by the environment. This destination may be shared with more standard objects ... Read More

C++ Standard Library Header Files

Moumita
Published on 15-Feb-2018 10:52:20
The C++ standard library comprises of different types of libraries. The following is a list of all these Types with the libraries under them.Utilities library<cstdlib>: General purpose utilities like program control, dynamic memory allocation, random numbers, sort and search<csignal>: Functions and macro constants for signal management(eg SIGINT, etc)<csetjmp>: Macro (and function) that ... Read More

Operators Precedence in C++

Jennifer Nicholas
Published on 15-Feb-2018 10:55:04
Operator precedence determines the grouping of terms in an expression. The associativity of an operator is a property that determines how operators of the same precedence are grouped in the absence of parentheses. This affects how an expression is evaluated. Certain operators have higher precedence than others; for example, the ... Read More

What is Pointer operator * in C++?

Vrundesha Joshi
Published on 15-Feb-2018 10:41:31
C++ provides two pointer operators, which are Address of Operator (&) and Indirection Operator (*). A pointer is a variable that contains the address of another variable or you can say that a variable that contains the address of another variable is said to "point to" the other variable. A ... Read More
Advertisements