What are Lvalues and Rvalues in C++

Jai Janardhan
Updated on 11-Feb-2020 09:52:30

3K+ Views

An lvalue (locator value) represents an object that occupies some identifiable location in memory (i.e. has an address).rvalues are defined by exclusion. Every expression is either an lvalue or an rvalue, so, an rvalue is an expression that does not represent an object occupying some identifiable location in memory.For example, An assignment expects an lvalue as its left operand, so the following is valid −int i = 10; But this is not: int i; 10 = i;This is because i has an address in memory and is a lvalue. While 10 doesn't have an identifiable memory location and hence is an rvalue. ... Read More

Types of Anonymous Inner Classes in Java

raja
Updated on 11-Feb-2020 09:26:32

1K+ Views

An anonymous inner class is an inner class which is declared without any class name at all. In other words, a nameless inner class is called an anonymous inner class. Since it does not have a name, it cannot have a constructor because we know that a constructor name is the same as the class name.We can define an anonymous inner class and create its object using the new operator at the same time in one step.Syntaxnew(argument-list){    // Anonymous class body }Types of Anonymous Inner Class in JavaAnonymous inner class that extends a classAnonymous inner class that implements an interfaceAnonymous inner ... Read More

Instantiate Member Inner Class in Java

raja
Updated on 11-Feb-2020 09:21:14

2K+ Views

A class that is declared inside a class but outside a method is known as member inner class.We can instantiate a member Inner class in two waysInvoked within the classInvoked outside the classRules for Inner ClassThe outer class (the class containing the inner class) can instantiate as many numbers of inner class objects as it wishes, inside its code.If the inner class is public & the containing class as well, then code in some other unrelated class can as well create an instance of the inner class.No inner class objects are automatically instantiated with an outer class object.If the inner ... Read More

Print Executed MySQL Statements in Batch Mode

Srinivas Gorla
Updated on 11-Feb-2020 08:30:25

307 Views

By using –v option in batch mode, the MySQL statements can be printed along with output. For example, after running the same query in batch mode with –v option we will get the statement printed along with output.C:\Program Files\MySQL\bin>mysql -u root -p gaurav < hh.sql -v Enter password: ***** -------------- select * from hh -------------- id 1 2It is showing the statement select * from hh which is written in the file hh.sql.

Enumerated Constants in C++

Rishi Raj
Updated on 11-Feb-2020 08:25:36

2K+ Views

An enumerated type declares an optional type name and a set of zero or more identifiers that can be used as values of the type. Each enumerator is a constant whose type is the enumeration. These are also called as enumerated constants.For example, if you are creating an application that has a fixed number of types for some variable. For example, let's say gender, it can be of three types male, female and others. You can define and use an enum like −#include using namespace std; enum Gender {MALE, FEMALE, OTHERS}; int main() {    Gender gen = Gender.FEMALE;   ... Read More

What are C++ Character Constants

Samual Sam
Updated on 11-Feb-2020 08:21:37

2K+ Views

Character constants are one or more members of the “source character set, ” the character set in which a program is written, surrounded by single quotation marks ('). They are used to represent characters in the “execution character set, ” the character set on the machine where the program executes. These are sometimes also called character literals.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 ... Read More

What are C++ Floating Point Constants

Lakshmi Srinivas
Updated on 11-Feb-2020 08:19:04

2K+ Views

Floating-point constants specify values that must have a fractional part.Floating-point constants have a "mantissa, " which specifies the value of the number, an "exponent, " which specifies the magnitude of the number, and an optional suffix that specifies the constant's type(double or float).The mantissa is specified as a sequence of digits followed by a period, followed by an optional sequence of digits representing the fractional part of the number. For example −24.25 12.00These values can also contain exponents. For example, 24.25e3 which is equivalent to 24250In C++ you can use the following code to create a floating point constant −ExampleLive ... Read More

What are C++ Integer Constants

karthikeya Boyini
Updated on 11-Feb-2020 08:13:31

3K+ Views

Integer constants are constant data elements that have no fractional parts or exponents. They always begin with a digit. You can specify integer constants in decimal, octal, or hexadecimal form. They can specify signed or unsigned types and long or short types.In C++ you can use the following code to create an integer constant −#include using namespace std; int main() {    const int x = 15; // 15 is decimal integer constant while x is a constant int.    int y = 015; // 15 is octal integer constant while y is an int.    return 0; }You can ... Read More

Difference Between Literal and Constant in C++

Fendadis John
Updated on 11-Feb-2020 08:12:28

786 Views

A literal is a value that is expressed as itself. For example, the number 25 or the string "Hello World" are both literals.A constant is a data type that substitutes a literal. Constants are used when a specific, unchanging value is used various times during the program. For example, if you have a constant named PI that you'll be using at various places in your program to find the area, circumference, etc of a circle, this is a constant as you'll be reusing its value. But when you'll be declaring it as −const float PI = 3.141;The 3.141 is a ... Read More

Literals in C++

Jai Janardhan
Updated on 11-Feb-2020 08:11:37

726 Views

A literal is any notation for representing a value within the source code. They just exist in your source code and do not have any reference a value in memory. Contrast this with identifiers, which refer to a value in memory.There are several types of literals in C++. Some of the examples of literals are −"Hello" (a string)3.141 (a float/double)true (a boolean)3 (an integer)'c' (a character)Things that are not literals −bar = 0; (a statement)3*5-4 (an expression)std::cin (an identifier)

Advertisements