Found 34483 Articles for Programming

Why do we use modifiers in C/C++?

Abhinaya
Updated on 26-Feb-2020 11:17:42

245 Views

A modifier is used to alter the meaning of the base type so that it works in accordance with your needs. For example, time cannot be negative and it makes sense to make it unsigned. C++ allows the char, int, and double data types to have modifiers preceding them. The data type modifiers are listed here −signedunsignedlongshortThe modifiers signed, unsigned, long, and short can be applied to integer base types. In addition, signed and unsigned can be applied to char, and long can be applied to double.The modifiers signed and unsigned can also be used as a prefix too long ... Read More

How to print out the first character of each list in Python?

Jayashree
Updated on 18-Jun-2020 13:35:47

4K+ Views

Assuming that the list is collection of strings, the first character of each string is obtained as follows −>>> L1=['aaa','bbb','ccc'] >>> for string in L1: print (string[0]) a b cIf list is a collection of list objects. First element of each list is obtained as follows −>>> L1=[[1,2,3],[4,5,6],[7,8,9]] >>> for list in L1: print (list[0]) 1 4 7

What is the type specifier for boolean in C++?

Govinda Sai
Updated on 26-Feb-2020 11:15:59

145 Views

The type specifier for boolean in c++ is bool. You can use it as −bool myBoolean = true;

What are type specifiers in C++?

Ramu Prasad
Updated on 10-Feb-2020 12:22:21

3K+ Views

When you first declare a variable in a statically typed language such as C++ you must declare what that variable is going to hold.int number = 42;In that example, the "int" is a type specifier stating that the variable "number" can only hold integer numbers. In dynamically typed languages such as ruby or javascript, you can simply declare the variable.var number = 42;There are a lot of built-in type specifiers like double, char, float, etc in C++. You can also create your own specifiers by creating class and structs.

What are type qualifiers in C++?

Sravani S
Updated on 30-Jul-2019 22:30:21

2K+ Views

A type qualifier is a keyword that is applied to a type, resulting in a qualified type. For example, const int is a qualified type representing a constant integer, while int is the corresponding unqualified type, simply an integer. Type qualifiers are a way of expressing additional information about a value through the type system and ensuring correctness in the use of the data. As of 2014 and C11, there are four type qualifiers in standard C: const (C89), volatile (C89), restrict (C99) and _Atomic (C11). The first two of these, const and volatile, are also present in C++ and ... Read More

How to Install C++ Compiler on Linux?

Rishi Raj
Updated on 10-Feb-2020 12:20:50

3K+ Views

There are several alternatives for compiling C++ on Linux. Let's look at 2 of them −GCCAlmost all Linux distros come with GCC installed. Check whether GCC is installed on your system by entering the following command from the command line −$ g++ -vIf you have installed GCC, then it should print a message such as the following −Using built-in specs. Target: i386-redhat-linux Configured with: ../configure --prefix=/usr ....... Thread model: posix gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)If GCC is not installed, then you will have to install it yourself using the detailed instructions available at https://gcc.gnu.org/install/. clangClang is a compiler developed ... Read More

Eclipse Setup for C++ Development

Arjun Thakur
Updated on 10-Feb-2020 12:18:06

176 Views

Step 0 − Install MinGW GCC or Cygwin GCCTo use Eclipse for C/C++ programming, you need a C/C++ compiler. On Windows, you could install either MinGW GCC or Cygwin GCC. Choose MinGW if you are not sure, because MinGW is lighter and easier to install, but has fewer features.MinGW GCC − To install MinGW, go to the MinGW homepage, www.mingw.org, and follow the link to the MinGW download page. Download the latest version of the MinGW installation program which should be named MinGW-.exe.While installing MinGW, at a minimum, you must install gcc-core, gcc-g++, Binutils, and the MinGW runtime, but you ... Read More

What are Character Literals in C++?

Nancy Den
Updated on 10-Feb-2020 12:14:28

657 Views

A character literal is a type of literal in programming for the representation of a single character's value within the source code of a computer program.In C++, A character literal is composed of a constant character. It is represented by the character surrounded by single quotation marks. There are two kinds of character literals −Narrow-character literals of type char, for example 'a'Wide-character literals of type wchar_t, for example L'a'The character used for a character literal may be any graphic character, except for reserved characters such as newline (''), backslash ('\'), single quotation mark ('), and double quotation mark ("). Reserved ... Read More

What are Boolean Literals in C++?

Daniol Thomas
Updated on 10-Feb-2020 12:10:57

290 Views

Boolean literals are literals that have either the meaning true or false. There are only two Boolean literals in C++: true and false. These literals are of type bool. You can use them as −Example#include using namespace std; int main() {    bool my_bool = true;    if(my_bool) {       cout

Tokens vs Identifiers vs Keywords in C++

Krantik Chavan
Updated on 30-Jul-2019 22:30:21

660 Views

A token is the smallest element of a C++ program that is meaningful to the compiler. The C++ parser recognizes these kinds of tokens: identifiers, keywords, literals, operators, punctuators, and other separators. A stream of these tokens makes up a translation unit. Tokens are usually separated by white space.The parser recognizes keywords, identifiers, literals, operators, and punctuators. Preprocessing tokens(like #include, #define, #if_def, etc.) are used in the preprocessing phases to generate the token stream passed to the compiler. The preprocessing token categories are header names, identifiers, preprocessing numbers, character literals, string literals, etc. that do not match one of the ... Read More

Advertisements