Found 34483 Articles for Programming

What does the volatile keyword mean in C++?

Priya Pallavi
Updated on 10-Feb-2020 12:25:23

2K+ Views

volatile means two things −- The value of the variable may change without any code of yours changing it. Therefore whenever the compiler reads the value of the variable, it may not assume that it is the same as the last time it was read, or that it is the same as the last value stored, but it must be read again.- The act of storing a value to a volatile variable is a "side effect" which can be observed from the outside, so the compiler is not allowed to remove the act of storing a value; for example, if ... Read More

What does the restrict keyword mean in C++?

Nikitha N
Updated on 30-Jul-2019 22:30:21

1K+ Views

There's no such keyword in C++. List of C++ keywords can be found in section 2.11/1 of C++ language standard. restrict is a keyword in the C99 version of C language and not in C++.In C, A restrict-qualified pointer (or reference) is basically a promise to the compiler that for the scope of the pointer, the target of the pointer will only be accessed through that pointer (and pointers copied from it).C++ compilers also support this definition for optimization purposes, but it is not a part of the official language specification.

Why do we use const qualifier in C++?

Srinivas Gorla
Updated on 10-Feb-2020 12:24:08

2K+ Views

We use the const qualifier to declare a variable as constant. That means that we cannot change the value once the variable has been initialized. Using const has a very big benefit. For example, if you have a constant value of the value of PI, you wouldn't like any part of the program to modify that value. So you should declare that as a const.Objects declared with const-qualified types may be placed in read-only memory by the compiler, and if the address of a const object is never taken in a program, it may not be stored at all.  For ... Read More

Why do we use restrict qualifier in C++?

Abhinanda Shri
Updated on 30-Jul-2019 22:30:21

186 Views

There's no such keyword in C++. List of C++ keywords can be found in section 2.11/1 of C++ language standard. restrict is a keyword in the C99 version of C language and not in C++.In C, A restrict-qualified pointer (or reference) is basically a promise to the compiler that for the scope of the pointer, the target of the pointer will only be accessed through that pointer (and pointers copied from it).C++ compilers also support this definition for optimization purposes, but it is not a part of the official language specification.

How to print a value for a given key for Python dictionary?

Jayashree
Updated on 26-Feb-2020 11:22:05

5K+ Views

Python dictionary is collection of key value pairs. Value associated with a certain key is returned by get() method.>>> D1={'a':11,'b':22,'c':33} >>> D1.get('b') 22You can also obtain value by using key inside square brackets.>>> D1['c'] 33

How to write the first C++ program?

Sai Nath
Updated on 26-Feb-2020 11:25:44

17K+ Views

So you've decided to learn how to program in C++ but don't know where to start. Here's a brief overview of how you can get started.Get a C++ CompilerThis is the first step you'd want to do before starting learning to program in C++. There are good free C++ compilers available for all major OS platforms. Download one that suits your platform or you can use the tutorialspoint.com's online compiler on https://www.tutorialspoint.com/compile_cpp_online.phpGCC − GCC is the GNU Compiler chain that is basically a collection of a bunch of different compilers created by GNU. You can download and install this compiler ... Read More

How to convert float to integer in Python?

Gireesha Devara
Updated on 23-Aug-2023 18:42:17

1K+ Views

In python there are two number data types: integers and floats. In general integers do not have any decimal points and base value is 10 (i.e., Decimal). Whereas floats have decimal points. Python provides some built−in methods to convert floats to integers. In this article we will discuss some of them. Using the int() function The int() function converts the floating point numbers to integers, by removing the decimals and remains only the integer part. Also the int() function does not round the float values like 49.8 up to 50. Example In the example the data after the decimal ... Read More

How do I set up C/C++ on Eclipse in Windows?

Arushi
Updated on 26-Feb-2020 11:21:22

8K+ Views

Step 1 − 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 GCCTo 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 ... Read More

How to convert an integer to a character in Python?

Gireesha Devara
Updated on 23-Aug-2023 18:36:02

22K+ Views

To convert an integer to a character in Python, we can use the chr() method. The chr() is a Python built−in method that returns a character from an integer. The method takes an integer value and returns a unicode character corresponding to that integer. Syntax char(number) Parameter The method takes a single integer between the range of 0 to 1, 114, 111. Return Value A unicode character of the corresponding integer argument. And it will raies a ValueError if we pass an out of range value (i, e. range(0x110000)). Also it will raise TypeError − for a non−integer argument. ... Read More

Why do we use a volatile qualifier in C++?

Ankitha Reddy
Updated on 30-Jul-2019 22:30:21

362 Views

volatile means two things − The value of the variable may change without any code of yours changing it. Therefore whenever the compiler reads the value of the variable, it may not assume that it is the same as the last time it was read, or that it is the same as the last value stored, but it must be read again. The act of storing a value to a volatile variable is a "side effect" which can be observed from the outside, so the compiler is not allowed to remove the act of storing a value; for example, ... Read More

Advertisements