Server Side Programming Articles - Page 2565 of 2650

Unary operator in C++

Nancy Den
Updated on 10-Feb-2020 13:15:43

2K+ Views

Unary operator is operators that act upon a single operand to produce a new value. The unary operators are as follows:OperatorsDescriptionIndirection 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 (+)The result of the unary plus ... Read More

Different types of operators in C++

Krantik Chavan
Updated on 26-Feb-2020 12:33:01

481 Views

There are many types of operators in C++. These can be broadly categorized as: arithmetic, relational, logical, bitwise, assignment and other operators.Arithmetic OperatorsAssume variable A holds 10 and variable B holds 20, then −OperatorDescription       +        Adds two operands. A + B will give 30-Subtracts second operand from the first. A - B will give -10*Multiplies both operands. A * B will give 200/Divides numerator by de-numerator. B / A will give 2%Modulus Operator and remainder of after an integer division. B % A will give 0++Increment operator, increases integer value by one. A++ will give ... Read More

The mutable storage class in C++

Akansha Kumari
Updated on 12-May-2025 19:38:58

2K+ Views

The mutable storage class in C++ is a property that gives you access to modify the non-static data members (not static data members) of a class, even when the object is declared as constant. This is mainly useful for scenarios where the data needs modification without affecting the logical state of the object, like caching, lazy initialization, and logging. Syntax class class_name { mutable data_type member_name; }; Here is the following syntax for the mutable storage class, which is declared using the mutable keyword and applied to only non-static data members of a class. Example #include ... Read More

The extern storage class in C++

Akansha Kumari
Updated on 15-May-2025 16:22:14

3K+ Views

The extern storage class specifier lets you declare objects that several source files can use.What is Extern Storage Class in C++?The extern storage class in C++ is used to declare an object (global variable or function) that can be accessed by multiple source files. When a variable is declared with extern, it tells the compiler that the variable or function exists in another file (or later in the same file) and that memory is not allocated at the point of declaration. Syntax Here is the following syntax for the extern storage class in C++. Here, it's a declaration, but no ... Read More

What does an auto keyword do in C++?

Akansha Kumari
Updated on 15-May-2025 17:09:35

8K+ Views

The auto keyword in C++ is used to automatically determine the type of variables from their initializer. This means you don’t need to explicitly tell the compiler the variable's data type. It lets the compiler determine the variable's type during compile time.C++ auto KeywordAuto was a keyword that C++ "inherited" from C that had been there nearly forever, but virtually never used. All this changed with the introduction of auto to do type deduction from the context in C++11. Before C++ 11, each data type needs to be explicitly declared at compile time, limiting the values of an expression at ... Read More

What are signed and unsigned keywords in C++?

Akansha Kumari
Updated on 13-Jun-2025 12:53:05

3K+ Views

In C++, the keywords signed and unsigned are used to specify that a given variable can hold negative values or only positive values. In this article, we will learn the differences between these two in more detail. C++ signed Keyword The signed keyword specifies that the given variable can hold both positive and negative values. Most integers, like int, short, long, etc, are by default signed (meaning they can store both positive and negative values). When an integer is represented in binary form, the most significant bit (MSB) or the leftmost bit represents the sign of the integer. When the most significant ... Read More

What does the volatile keyword mean in C++?

Priya Pallavi
Updated on 10-Feb-2020 12:25:23

2K+ Views

volatile means two things −- The value of the variable may change without any code of yours changing it. Therefore whenever the compiler reads the value of the variable, it may not assume that it is the same as the last time it was read, or that it is the same as the last value stored, but it must be read again.- The act of storing a value to a volatile variable is a "side effect" which can be observed from the outside, so the compiler is not allowed to remove the act of storing a value; for example, if ... Read More

What does the restrict keyword mean in C++?

Akansha Kumari
Updated on 29-May-2025 15:38:35

2K+ Views

There's no such keyword in C++. A list of C++ keywords can be found in section 2.11/1 of the C++ language standard. It is a keyword in the C99 version of the C language and not in C++. In C, A restrict qualified pointer (or reference) is basically a promise to the compiler that, within the scope of the pointer, the target of the pointer will only be accessed through that restrict qualified pointer (and pointers copied from it). C++ compilers also support this definition for optimization purposes, but it is not a part of the official language specification. ... Read More

Why do we use const qualifier in C++?

Srinivas Gorla
Updated on 10-Feb-2020 12:24:08

2K+ Views

We use the const qualifier to declare a variable as constant. That means that we cannot change the value once the variable has been initialized. Using const has a very big benefit. For example, if you have a constant value of the value of PI, you wouldn't like any part of the program to modify that value. So you should declare that as a const.Objects declared with const-qualified types may be placed in read-only memory by the compiler, and if the address of a const object is never taken in a program, it may not be stored at all.  For ... Read More

Why do we use restrict qualifier in C++?

Abhinanda Shri
Updated on 30-Jul-2019 22:30:21

288 Views

There's no such keyword in C++. List of C++ keywords can be found in section 2.11/1 of C++ language standard. restrict is a keyword in the C99 version of C language and not in C++.In C, A restrict-qualified pointer (or reference) is basically a promise to the compiler that for the scope of the pointer, the target of the pointer will only be accessed through that pointer (and pointers copied from it).C++ compilers also support this definition for optimization purposes, but it is not a part of the official language specification.

Advertisements