Programming in C/C++

-
Macro in C language – Linux Hint
A macro in C language is a piece of code which has been assigned a name. When the name is used anywhere in the program, the macro value is replaced before the program’s compilation. In this article, we will see in detail how to write a macro in C language.
-
Exception Handling in C++ – Linux Hint
There are three types of software errors that exist. These are Syntax Errors, Logic Errors, and Runtime Errors.
-
C++ Qualifiers and Storage Class Specifiers – Linux Hint
CV stands for Constant-Volatile. The declaration of an object that is not preceded by const and/or volatile is a cv-unqualified type. On the other hand, the declaration of an object that is preceded by const and/or volatile is a cv-qualified type. If an object is declared const, the value in its location cannot be changed. A volatile variable is a variable whose value is under the influence of the programmer, and hence cannot be changed by the compiler.Storage Class Specifiers refer to the life, place, and way in which a type exists. Storage class specifiers are static, mutable, thread_local, and extern.
This article explains C++ Qualifiers and Storage Class Specifiers. Thus, some preliminary knowledge in C++ comes in handy to really appreciate the article.
-
Overloading in C++ – Linux Hint
C++ does not allow a function that adds two integers and return an integer, to add two floats and return a float. Imagine that there is a function to add two integers and return an integer. Would it not be nice to have another function with the same name, that adds but two or even more floats to return a float? Doing so is said to be, overloading the first function.
Arithmetic operators are typically used for arithmetic operations. Is it not nice to have the +, join two strings? Enabling that is said to be overloading the arithmetic addition operator, for strings.The increment operator, ++ adds 1 to an int or a float. When dealing with pointers, it does not add 1 to the pointer. It makes the pointer point to the next consecutive object in memory. An iterator points to the next object in a linked-list, but the linked-list objects are in different places in memory (not in consecutive regions). Would it not be nice to overload the increment operator for an iterator, to increment but point to the following element, in the linked-list?
This article explains overloading in C++. It is divided into two parts: function overloading and operator overloading. Having already basic knowledge in C++ is necessary to understand the rest of the article.
-

- Login or register to post comments
Printer-friendly version- 2146 reads
PDF version
More in Tux Machines
- Highlights
- Front Page
- Latest Headlines
- Archive
- Recent comments
- All-Time Popular Stories
- Hot Topics
- New Members
digiKam 7.7.0 is released
After three months of active maintenance and another bug triage, the digiKam team is proud to present version 7.7.0 of its open source digital photo manager. See below the list of most important features coming with this release.
|
Dilution and Misuse of the "Linux" Brand
|
Samsung, Red Hat to Work on Linux Drivers for Future Tech
The metaverse is expected to uproot system design as we know it, and Samsung is one of many hardware vendors re-imagining data center infrastructure in preparation for a parallel 3D world.
Samsung is working on new memory technologies that provide faster bandwidth inside hardware for data to travel between CPUs, storage and other computing resources. The company also announced it was partnering with Red Hat to ensure these technologies have Linux compatibility.
|
today's howtos
|








.svg_.png)
Content (where original) is available under CC-BY-SA, copyrighted by original author/s.

Recent comments
1 year 11 weeks ago
1 year 11 weeks ago
1 year 11 weeks ago
1 year 11 weeks ago
1 year 11 weeks ago
1 year 11 weeks ago
1 year 11 weeks ago
1 year 11 weeks ago
1 year 11 weeks ago
1 year 11 weeks ago