- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 34483 Articles for Programming
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
1K+ Views
The mutable storage class specifier is used only on a class data member to make it modifiable even though the member is part of an object declared as const. You cannot use the mutable specifier with names declared as static or const, or reference members.In the following example −class A { public: A() : x(4), y(5) { }; mutable int x; int y; }; int main() { const A var2; var2.x = 345; // var2.y = 2345; }the compiler would not allow the assignment var2.y = 2345 because var2 has been declared ... Read More
3K+ Views
The extern storage class specifier lets you declare objects that several source files can use. An extern declaration makes the described variable usable by the succeeding part of the current source file. This declaration does not replace the definition. The declaration is used to describe the variable that is externally defined.An extern declaration can appear outside a function or at the beginning of a block. If the declaration describes a function or appears outside of a function and describes an object with external linkage, the keyword extern is optional.If a declaration for an identifier already exists at file scope, any ... Read More
436 Views
The static storage class instructs the compiler to keep a local variable in existence during the lifetime of the program instead of creating and destroying it each time it comes into and goes out of scope. Therefore, making local variables static allows them to maintain their values between function calls.The static modifier may also be applied to global variables. When this is done, it causes that variable's scope to be restricted to the file in which it is declared.In C++, when static is used on a class data member, it causes only one copy of that member to be shared ... Read More
290 Views
In C, the register storage class specifier indicates to the compiler that the object should be stored in a machine register. The register storage class specifier is typically specified for heavily used variables, such as a loop control variable, in the hopes of enhancing performance by minimizing access time. However, the compiler is not required to honor this request. Because of the limited size and number of registers available on most systems, few variables can actually be put in registers.In C++ it is simply an unused reserved keyword, but it's reasonable to assume that it was kept for syntactical compatibility ... Read More
177 Views
In C, The auto storage class specifier lets you explicitly declare a variable with automatic storage. The auto storage class is the default for variables declared inside a block. A variable x that has automatic storage is deleted when the block in which x was declared exits.You can only apply the auto storage class specifier to names of variables declared in a block or to names of function parameters. However, these names by default have automatic storage. Therefore the storage class specifier auto is usually redundant in a data declaration.It was initially carried over to C++ for syntactical compatibility only, ... Read More
145K+ Views
Once you've got your compiler and source program ready, it is very easy to compile and run a C++ program. Assuming that you've installed GCC compiler, and you have a source.cpp file that you want to compile, follow the following instructions to compile and run it. Step 1 − Open a new terminal window or cmd if you are on windows. Step 2 − Change the directory to the directory in which you have your source.cpp file. For example, if it is in C:/Users/Dell/Documents, enter your command line − $ cd 'C:/Users/Dell/Documents' Step 3 − Now enter the following command ... Read More
3K+ Views
This guide will help you become familiar with many of the tools and dialog boxes that you can use when you develop applications in C++ with Visual Studio. We'll create a "Hello, World" - style console application to help you learn more about working in this IDE.PrerequisitesTo follow along, you need a copy of Visual Studio 2017 version 15.3 or later, with the Desktop development with C++ workload installed. For a fast guide to installation, see Install C++ support in Visual Studio(https://docs.microsoft.com/en-us/cpp/build/vscpp-step-0-installation).Create a console appStart Visual StudioTo create a console app project, choose File > New > Project to open ... Read More
7K+ Views
Auto 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 runtime but after a new version of C++, many keywords are included which allows a programmer to leave the type deduction to the compiler itself.With type inference capabilities, we can spend less time having to write out things compiler already knows. As all ... Read More
2K+ Views
All number types in C++ can either have a sign or not. For example, you can declare an int to only represent positive integers. Unless otherwise specified, all integer data types are signed data types, i.e. they have values which can be positive or negative. The unsigned keyword can be used to declare variables without signs.Example#include using namespace std; int main() { unsigned int i = -1; int x = i; cout