
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 7197 Articles for C++

2K+ Views
In C++, declaration and definition are often confused. A declaration tells the compiler about the name and type, while a definition allocates memory or provides implementation. In this article, we will understand their differences with examples. What is a Declaration in C++? A declaration means (in C or C++) that you are telling the compiler about type, size and in case of function declaration, type and size of its parameters of any variable, or user-defined type or function in your program. No space is reserved in memory for any variable in case of the declaration. Following is the syntax to ... Read More

603 Views
In C++, declaration and definition are often confused. A declaration means (in C) that you are telling the compiler about type, size and in case of function declaration, type and size of its parameters of any variable, or user-defined type or function in your program. No space is reserved in memory for any variable in case of a declaration.The Definition on the other hand means that in additions to all the things that declaration does, space is additionally reserved in memory. You can say "DEFINITION = DECLARATION + SPACE RESERVATION".Following are examples of declarations −extern int a; ... Read More

372 Views
An enumerated type declares an optional type name and a set of zero or more identifiers that can be used as values of the type. Each enumerator is a constant whose type is the enumeration. For example, if you are creating an application that has a fixed number of types for some variable. For example, let's say gender, it can be of three types male, female and others. You can define and use an enum like −#include using namespace std; enum Gender {MALE, FEMALE, OTHERS}; int main() { Gender gen = Gender.FEMALE; return 0; }By default, the value ... Read More

1K+ 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

844 Views
An enumerated type declares an optional type name and a set of zero or more identifiers that can be used as values of the type. Each enumerator is a constant whose type is the enumeration. For example, if you are creating an application that has a fixed number of types for some variable. For example, let's say gender, it can be of three types male, female and others. You can define and use an enum like −#include using namespace std; enum Gender {MALE, FEMALE, OTHERS}; int main() { Gender gen = Gender.FEMALE; return 0; }By default, the value ... Read More

5K+ Views
In C++, operators are special symbols that are designed to perform various Operations on variables and values, like arithmetic, comparison, or logical operations. A Postfix Operator is a type of operator that is used to increment or decrement a value by 1(unless overloaded). It is a unary operator, which works only on a single variable. There are two types of postfix operators in C++: ++ : Post-increment -- : Post-decrement Post Increment Operator (++) The post-increment operator increments the value of a given variable by 1, but only after its ... Read More

7K+ Views
In C++, bitwise operators are used to perform operations on binary numbers. Since computers store all data in the form of binary (0s and 1s), therefore, every value, like decimal numbers, characters, and booleans, is internally represented in binary. for example: 5 = 00000101 and 3 = 00000011 To learn more about how to convert these decimal values to binary, you can visit this page: Decimal to Binary Conversion. Shift Operators in C++ The shift operator is one of the types of bitwise operators, which are used to move bits of a number left or right. There are two types of ... Read More

311 Views
The multiplicative operators are −Multiplication (*)Division (/)Modulus or “remainder from division” (%)These binary operators have left-to-right associativity. The multiplicative operators take operands of arithmetic sorts. The modulus operator (%) contains a stricter requirement in this its operands should be of integral type.The multiplication operator yields the result of multiplying the first operand by the second.The division operator yields the result of dividing the first operand by the second.The modulus operator yields the remainder given by the subsequent expression, wherever e1 is that the 1st operand and e2 is that the second: e1 – (e1 / e2) * e2, where both ... Read More

555 Views
In C++, typedef is a keyword that is used to create a new name for an existing data type. This helps the users to modify the code according to their preference, making it more readable, friendly, and manageable. Syntax Here is the following basic syntax of typedef in C++; typedef existing_type new_name; Here, existing_type is the original data type given in the C++ standard (e.g., int, float, double, etc.)new_name is the new name assigned to that type. Example Here is the following simple example showcasing the use of typedef in C++: #include using namespace std; // Defining ... Read More

196 Views
Program comments are explanatory statements that you can include in the C++ code. These comments help anyone reading the source code. All programming languages allow for some form of comments.C++ supports single-line and multi-line comments. All characters available inside any comment are ignored by C++ compiler.Single line commentsTo create a single line comment, we use the // notation. Wherever you want to start the comment, start it with //. For example,// This is a comment cout