Found 7290 Articles for C++

Tokens vs Identifiers vs Keywords in C++

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

822 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

What do you mean by C++ Tokens?

Nishtha Thakur
Updated on 30-Jul-2019 22:30:21

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

How to Install C++ Compiler on Windows?

Arushi
Updated on 10-Feb-2020 12:09:05

5K+ Views

There are several alternatives for compiling C++ on windows. Let's look at 2 of them:GCCTo install GCC on Windows you need to install MinGW. 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 may wish to install more.Add the bin subdirectory of your MinGW installation to your PATH environment variable so that you can specify these tools on the command ... Read More

Can a C++ variable be both const and volatile?

Smita Kapse
Updated on 30-Jul-2019 22:30:21

2K+ Views

Yes a C++ variable be both const and volatile. It is used in situations like a read-only hardware register, or an output of another thread. Volatile means it may be changed by something external to the current thread and Const means that you do not write to it (in that program that is using the const declaration).

What is the difference between #define and const Keyword in C++?

Anvi Jain
Updated on 30-Jul-2019 22:30:21

321 Views

The #define directive is a preprocessor directive; the preprocessor replaces those macros by their body before the compiler even sees it. Think of it as an automatic search and replace of your source code.A const variable declaration declares an actual variable in the language, which you can use like a real variable: take its address, pass it around, cast it, convert it, etc.Without compiler optimizations, there is a hidden cost of memory allocation associated with both of these in different cases. But with proper optimizations they are more or less the same. Also, preprocessor macros don't have any scope, while ... Read More

C++ Programming Language Features

Vikyath Ram
Updated on 18-Jun-2020 13:20:55

678 Views

C++ is regarded as a middle-level language, as it comprises a combination of both high-level and low-level language features. It is a superset of C, and that virtually any legal C program is a legal C++ program. C++ runs on a variety of platforms, such as Windows, Mac OS, and the various versions of UNIX. Following are some of the features of C++ that make it stand out among other programming languages −Multi-paradigm language − C++ is a language that supports procedural, object-oriented and generic programming. This makes it very versatile.Use of pointers and references − C++ supports pointers and ... Read More

What is the const Keyword in C++?

Akansha Kumari
Updated on 17-Apr-2025 18:50:20

532 Views

The const keyword in C++ is a keyword that is used to declare variables and objects as constant, which means the value declared using const cannot be changed or modified later, once they are initialized. This helps them prevent accidental modifications. For example, in a code, if we are using the value of PI, which has a fixed universal value and doesn't need any change, then we can declare it as a constant. When you declare the object with the const keyword, then the compiler places that value in ROM (Read-Only Memory), which protects it from being changed ... Read More

History of C++ language

Fendadis John
Updated on 30-Jul-2019 22:30:21

3K+ Views

The C++ programming language has a history going back to 1979, when Bjarne Stroustrup was doing work for his Ph.D. thesis. He began work on "C with Classes", which as the name implies was meant to be a superset of the C language. His goal was to add object-oriented programming into the C language, which was and still is a language well-respected for its portability without sacrificing speed or low-level functionality.His language included classes, basic inheritance, inlining, default function arguments, and strong type checking in addition to all the features of the C language. The first C with Classes compiler ... Read More

How are C++ Local and Global variables initialized by default?

Vrundesha Joshi
Updated on 30-Jul-2019 22:30:21

651 Views

The following is the same for both local and global variables. Basically, whenever you declare a variable, the compiler will call its default constructor unless you specify otherwise.The language level types (e.g. pointers, 'int', 'float', 'bool', etc) "default constructor" does absolutely nothing, it just leaves the memory as it is when it is declared.  This means that they can be pretty much anything because you usually can't be sure what was in that memory previously or even where the memory came from.If you create a class that doesn't have a constructor, the compiler will create one for you which simply ... Read More

Different C++ Versions

Akansha Kumari
Updated on 11-Apr-2025 14:08:42

9K+ Views

C++ is a general-purpose, object-oriented programming language, which was developed by Bjarne Stroustrup at Bell Labs in the 1980s. It's an extension of the C language as it includes C features with additional object-oriented concepts like classes, inheritance, polymorphism, encapsulation, and abstraction.Before, it was known as "C with Classes" around 1979, but later renamed as C++ in 1983. These versions of the C++ language are compilers, which are implemented with the following rules made by the ISO C++ community, the community that looks over the development of the language. Here is the following list of C++ versions. ... Read More

Advertisements