- 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 7346 Articles for C++
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
1K+ Views
GNU C++ compiler, g++, provides extensions to the C++ language. The difference between the two options is whether these GNU extensions that might violate the C++ standard are enabled or not. Note that some extensions can still be in effect when using -std = c++11, if they don't violate the standard.The list of extensions to the C++ language in GNU compiler can be found here − https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Extensions.html
![Nishtha Thakur](https://www.tutorialspoint.com/assets/profiles/13598/profile/60_104893-1512719058.jpg)
317 Views
C++ and C Standards are usually named after the year they are published in. For example, in C++, the original Standard was published in 1998, so it is called C++98, and its first correction, published in 2003 is called C++03.For the next revision, it was supposed that the next Standard after would be done by 2008, but since it was uncertain, it was named C++0x, where the x stood for either 8 or 9. Though planning shifted and it is now called C++11. So, C++0x was the name for the standard before it was published. Once it was finalized in ... Read More
![Abhinanda Shri](https://www.tutorialspoint.com/assets/profiles/13552/profile/60_73264-1512711555.jpg)
255 Views
In a nutshell, placement new allows you to "construct" an object on memory that's already allocated to a given variable. This is useful for optimizations as it is faster to not reallocate and reuse the same memory that is already assigned to it. It can be used as follows −new (address) (type) initializerWe can specify an address where we want a new object of the given type to be constructed. Example#include using namespace std; int main() { int a = 5; cout
![Smita Kapse](https://www.tutorialspoint.com/assets/profiles/13597/profile/60_103706-1512718957.jpg)
1K+ Views
C++98 was the first edition of the C++ standard. It had defined all the basic language constructs, the STL, and the standard library.C++03 was the next revision to this standard. This was majorly a considered a bugfix for the standard as it corrected 92 core language defect reports, 125 library defect reports, and included only one new language feature: value initialization.C++0x was the name of the work in progress that was expected to complete by 2008-09 but finally completed in 2011.C++11 was the modern C++ standard published in 2011. This brought many major extensions and improvements to the existing language. ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
535 Views
The rule of five is applied in C++ for resource management. Resource management frees the client from having to worry about the lifetime of the managed object, potentially eliminating memory leaks and other problems in the C++ code. But this management comes at a cost. The Rule of The Big Five states that if you have to write one of the following functions then you have to have a policy for all of them. If we have an Object Foo then we can have a FooManager that handles the resource Foo. When implementing FooManager, you'll likely all need the following ... Read More
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
395 Views
The Rule of three is a rule of thumb when using C++. This is kind of a good practice rule that says that If your class needs any ofa copy constructor, an assignment operator, or a destructor, defined explicitly, then it is likely to need all three of them.Why is this? Its because, if your class requires any of the above, it is managing dynamically allocated resources and would likely be needing the other to successfully achieve that. For example, if you require an assignment operator, you would be creating copies of objects currently being copied by reference, hence allocating ... Read More
![Abhinaya](https://www.tutorialspoint.com/assets/profiles/13548/profile/60_54851-1512705920.jpg)
380 Views
Having to create a potential large array on the stack, which usually has only little space available, isn't good. If you know the size beforehand, you can use a static array. And if you don't know the size beforehand, you will write unsafe code. Variable-length arrays can not be included natively in C++ because they'll require huge changes in the type system.An alternative to Variable-length arrays in C++ is provided in the C++ STL, the vector. You can use it like −Example#include #include using namespace std; int main() { vector vec; vec.push_back(1); vec.push_back(2); vec.push_back(3); ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
1K+ Views
A dynamic 2D array is basically an array of pointers to arrays. So you first need to initialize the array of pointers to pointers and then initialize each 1d array in a loop.example#include using namespace std; int main() { int rows = 3, cols = 4; int** arr = new int*[rows]; for(int i = 0; i < rows; ++i) arr[i] = new int[cols]; return 0; } This will create an 2D array of size 3x4. Be vary of clearing the memory in such cases as you'll need to delete the memory in the ... Read More
![Anvi Jain](https://www.tutorialspoint.com/assets/profiles/13591/profile/60_98631-1512716973.jpg)
2K+ Views
The difference between the two forms is in the location where the preprocessor searches for the file to be included.#include The preprocessor searches in an implementation-dependent manner, it searches directories pre-designated by the compiler. This method is usually used to include standard library header files.#include "filename"The preprocessor searches in the same directory as the file containing the directive. If this fails, then it starts behaving like the #include form. This method is usually used to include your own header files.