Found 7346 Articles for C++

Unary operators in C++

Rama Giri
Updated on 11-Feb-2020 06:53:36

228 Views

Unary operator are operators that act upon a single operand to produce a new value. The unary operators are as follows −Indirection operator (*) - It operates on a pointer variable, and returns an l-value equivalent to the value at the pointer address. This is called "dereferencing" the pointer.Address-of operator (&) - The unary address-of operator (&) takes the address of its operand. The operand of the address-of operator can be either a function designator or an l-value that designates an object that is not a bit field and is not declared with the register storage-class specifier.Unary plus operator (+) - ... Read More

Identifiers in C++

Manikanth Mani
Updated on 30-Jul-2019 22:30:21

5K+ Views

The C++ identifier is a name used to identify a variable, function, class, module, or any other user-defined item. An identifier starts with a letter A to Z or a to z or an underscore (_) followed by zero or more letters, underscores, and digits (0 to 9).C++ does not allow punctuation characters such as @, $, and % within identifiers. C++ is a case-sensitive programming language. Thus, Manpower and manpower are two different identifiers in C++.Here are some examples of acceptable identifiers −mohdPiyushabcmove_namea_123myname50_tempja23b9retVal

Reserved keywords in C++?

Arjun Thakur
Updated on 19-Jun-2020 05:31:50

9K+ Views

A reserved word is a word that cannot be used as an identifier, such as the name of a variable, function, or label – it is "reserved from use". This is a syntactic definition, and a reserved word may have no meaning.There are a total of 95 reserved words in C++. The reserved words of C++ may be conveniently placed into several groups. In the first group, we put those that were also present in the C programming language and have been carried over into C++. There are 32 of these. There are another 30 reserved words that were not in ... Read More

Trigraphs in C++

Jai Janardhan
Updated on 30-Jul-2019 22:30:21

200 Views

The ISO-646 character set does not have all the characters of the C syntax, therefore there are some systems with keyboards and displays that cannot deal with some characters. These characters can be constructed using a sequence of 3 characters called trigraphs. In C, before any other processing takes place, each occurrence of one of the following sequences of three characters (“trigraph sequences”) is replaced by the single character.trigraphreplacementtrigraphreplacementtrigraphreplacement??=#??([??}??’ˆ??!|??-˜They are there mostly for historical reasons. Nowadays, most modern keyboards for most languages allow access to all those characters, but this used to be a problem once with some European keyboards. ... Read More

C++ Operators with Precedence and Associativity

Anvi Jain
Updated on 30-Jul-2019 22:30:21

3K+ Views

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 multiplication operator has higher precedence than the addition operator:For example, x = 7 + 3 * 2; here, x is assigned 13, not 20 because operator * has higher precedence than +, so it first gets multiplied with 3*2 and then adds into 7.Here, operators with the highest precedence appear ... Read More

C++ Keywords

Alankritha Ammu
Updated on 30-Jul-2019 22:30:21

6K+ Views

Keywords are those words whose meaning is already defined by Compiler. These keywords cannot be used as an identifier. Note that keywords are the collection of reserved words and predefined identifiers. Predefined identifiers are identifiers that are defined by the compiler but can be changed in meaning by the user. For example, you could declare a variable called main inside your main function, initialize it, and then print out its value (but ONLY do that to verify that you can!). On the other hand, you could not do this with a variable named else. The difference is that else is a ... Read More

Why does C++ need the scope resolution operator?

Nitya Raut
Updated on 11-Feb-2020 06:44:46

502 Views

The :: (scope resolution) operator is used to get hidden names due to variable scopes so that you can still use them. The scope resolution operator can be used as both unary and binary.You can use the unary scope operator if a namespace scope or global scope name is hidden by an explicit declaration of the same name in a block or class. For example, if you have a global variable of name my_var and a local variable of name my_var, to access global my_var, you'll need to use the scope resolution operator. For example, Example#include   using namespace ... Read More

What is the use of scope resolution operator in C++?

Jennifer Nicholas
Updated on 11-Feb-2020 06:43:03

389 Views

The :: (scope resolution) operator is used to get hidden names due to variable scopes so that you can still use them. The scope resolution operator can be used as both unary and binaryYou can use the single scope operator if a namespace scope or global scope name is hidden by a certain declaration of a similar name during a block or class. For example, if you have a global variable of name my_var and a local variable of name my_var, to access global my_var, you'll need to use the scope resolution operator. For example, Example#include   using namespace ... Read More

Scope resolution operator in C++

Nancy Den
Updated on 11-Feb-2020 06:00:07

6K+ Views

The :: (scope resolution) operator is used to get hidden names due to variable scopes so that you can still use them. The scope resolution operator can be used as both unary and binary. You can use the unary scope operator if a namespace scope or global scope name is hidden by a particular declaration of an equivalent name during a block or class. For example, if you have a global variable of name my_var and a local variable of name my_var, to access global my_var, you'll need to use the scope resolution operator.example#include   using namespace std;   ... Read More

Equality Operators: == and != in C++

Vrundesha Joshi
Updated on 11-Feb-2020 05:58:08

678 Views

The equality operators in C++ are is equal to(==) and is not equal to(!=). They do the task as they are named. The binary equality operators compare their operands for strict equality or inequality. The equality operators, equal to (==) and not equal to (!=), have lower precedence than the relational operators, but they behave similarly. The result type for these operators is bool.The equal-to operator (==) returns true (1) if both operands have the same value; otherwise, it returns false (0). The not-equal-to operator (!=) returns true if the operands do not have the same value; otherwise, it returns ... Read More

Advertisements