Variables in C++ - Reading Assignment

  1. A variable in C++ Refers to a named Object.
  2. The Definition of a variable is a special kind of Declaration Statement used to create the variable.
  3. The Instantiation or Instance of a variable is when the variable is created and assigned a memory address.
  4. l-values are values that have their place in memory, r-values are values (or expressions) that are discarded at the end of a statement and therefore need not to be associated with a memory address
  5. An uninitialized variable is a variable that was not initialized or assigned a value when created. Uninitialized variables cause Undefined Behaviors.
    6.Who knows what you will get with undefined behaviors
1 Like

1 Variable is a named object

2 Object carrying a value

3 Instantiation (Instance) is the creation of an object and assignation of a memory address by the compiler (the logistic manager)

4 L-value is like the human ,long life and with specific address existing in a body (object-variable)

R-value is like the food the human consumes, it only exists while the body absorbs it (while code is running) then expires.

5 A variable is uninitialized when no value has been assigned to it or the value is set to empty

6 Undefined behavior appears when C/C++ are running meaningless codes and giving some absurd results or even crashing. Where in ā€œsafeā€ programming language it would be trapped. (JS)

1 Like

1: It is a named object in C++.
2:special declaration for a variable, like int m; that is telling the program that m is a var that can hold a value.
3: The object will be created and assigned to new memory addresses in the RAM.
4: I-value has a persistent address, while r-value does not have a persistent address.
5: The variable is unknown within the memory and the program may yield unexpected results.
6: Unpredictable behavior from the program because of an uninitialized variable.

1 Like
  1. A variable in C++ is a named object and the name of the object is called an identifier.

  2. The definition of a variable is the creation of a variable using a special kind of declaration statement,eg. int = x;

  3. An instantiation of a variable occurs when the program is run and the object is created and assigned a memory address.

  4. The l-value refers to the location of a variable and the r-value refers to the contents of a variable.

  5. An uninitialized variable is one that has not been given a known value by the program that is running.

  6. Undefined behaviour is the result of executing code whose behaviour is not well defined by the C++ language. Using a value from an uninitialized variable would be an example of undefined behaviour.

1 Like
  1. What is a variable in C++? - A variable is a named object
  2. What is the Definition of a variable? - A kind of declaration statement in order to create a variable
  3. What is Instantiation of a variable? - Instantiation is the process of assigning the memory address to a created object.
  4. What is the difference between an l-value and an r-value? - A lvalue always has a defined region of storage, so you can take its address. An rvalue does not necessarily have any storage associated with it.
  5. What is an uninitialized variable and what kind of behavior can you expect from such a variable? - An uninitialized variable is a variable that is declared but is not set to a definite known value before it is used. It will have some value , but not a predictable one. As such, it is a programming error and a common source of bugs in software.
  6. What is undefined behavior? - Undefined behaviour occurs when a program does something the result of which is not specified by the standard.
1 Like

What is a variable in C++?
A variable in C++ is a named object. And an object is region of storage which has value or other properties.

What is Definition of a variable?
A definition is a type of declaration which is needed to creat a variable.

What is Instantiation of a variable?
Instantiation of a variable means that the variable is assigned a memory address

What is the difference between an l-value and an r-value?
I-value has a address while r-variable does not

What is an uninitialized variable and what kind of behaviour can you expect from such a variable?
Uninitialized variable has a address but no value

What is undefined behaviour?
Very unpredictable.

1 Like
  1. A variable is a region of storage that has a value and other associated properties.

  2. A variable is a name given to a memory location. It is the basic unit of storage in a program.

  3. It is the creation and allocation of a memory address, as variables must be instantiated before they can be used to store value.

  4. l-value is an expression that refers to an object. Usually refers to objects that appears on the left-hand side on an expression. r-value is any expression that has a value but cannot have a value assigned to it.

  5. It is a variable that has not been given a value by the program. Using the value stored in an unitialized variable will result in undefined behavior.

  6. Undefined behavior occurs when a program does something the result of which is not specified by the standards. It is the result of executing code whose behavior is not well defined by the c++ language.

1 Like
  1. What is a variable in C++?we use variables to access memory. Variables have an identifier, a type, and a value (and some other attributes that aren’t relevant here). A variable’s type is used to determine how the value in memory should be interpreted.
  2. What is the Definition of a variable? int x
  3. What is Instantiation of a variable? . Instantiation is a fancy word that means the object will be created and assigned a memory address. Variables must be instantiated before they can be used to store values.
  4. What is the difference between an l-value and an r-value?The l-value refers to the location of a variable and the r-value refers to the contents of a variable.
  5. What is an uninitialized variable and what kind of behavior can you expect from such a variable?variable does not have a value
  6. What is undefined behavior?
1 Like
  1. It is a specific region in memory that is accessed every time that variable is called

  2. It is a name associated with that memory address

  3. An object will be created and assigned to the memory address

  4. I-value has a specific memory address and r-value does not have a specific address

  5. A variable without a value

  6. Unpredictable behavior

1 Like
1, A variable is a named region of memory.
2. The definition of a variable is a declaration statement including a declaration of its value
3.  Instantiation means the object is created and assigned a memory address. 
4. An L value is an identifier of an object and an R value is the data of that object stored in the memory
5. An uninitialized variable does not have a known value
6. Undefined behaviors is executing code not within the rules of C++ which can result in unpredictable behavior.
2 Likes
  1. A object that has a name.

  2. Specifying the type and name for a variable.

  3. RAM allocation for a variable.

  4. I-value has a persistent address. R-valuea doesn’t have a persistent address.

  5. A variable that hasn’t been given a value. We can see the compiler assigning a random space in the memory which can change every time we run the code.

  6. It occurs when the result of the program by executing the code which is not well defined by the language.

1 Like
  • What is a variable in C++?
    Objects can be named or unnamed (anonymous). A named object is called a variable, and the name of the object is called an identifier. In our programs, most of the objects we create will be variables.

  • What is the Definition of a variable?
    Giving the name and a tyoe to a variable, like int a; ā€œaā€ defines the variable.

  • What is Instantiation of a variable?
    When the program is run, the variable will be instantiation.
    meaning that the object will be created and assigned a memory adress.

  • What is the difference between an l-value and an r-value?
    l-value are the objects and can be referenced, r-values are assignments that change the values in objects.

  • What is an uninitialized variable and what kind of behavior can you expect from such a variable?
    is a variable that has not been given a value by the program. Using the value stored in an uninitialized variable will result in undefined behavior

  • What is undefined behavior?
    is the result of executing a code whose behaviour is not well defined by the c++.

1 Like

1.) a named Object and a tool to access memory
2.) a Named region of memory
3.) the creation and assignment of an Object
4.) l-Value: Container. Points to a specific memory adress
r-Value: thing contained by container. has no adress.
5.) A Variable that has not been given a Value yet. The computer will assign unused memory to it.
6.) Behaviour that occurs since there are no rules determining what to do. Result unpredictable.e

1 Like
  1. What is a variable in C++?
    It is a named object.

  2. What is Definition of a variable?
    A definition is a special kind of declaration statement.

  3. What is Instantiation of a variable?
    It means the object will be created and assigned a memory address.

  4. What is the difference between an l-value and an r-value?
    l-value has a specific memory location and r-value has no specific memory address, because it is temporary.

  5. What is an uninitialized variable and what kind of behaviour can you expect from such a variable?
    It is a variable that is not initialized, it couses unexpected results.

  6. What is undefined behaviour?
    Undefined behavior is the result of executing code, whose behaviour is not well defined.

1 Like
  1. What is a variable in C++?
    A variable is a named object that stores the data of the variable.
  2. What is Definition of a variable?
    To create a variable with a name and type but not a value.
  3. What is Instantiation of a variable?
    When a variable is created and assigned a memory address
  4. What is the difference between an l-value and an r-value?
    l-values are identifiers. r-values are the data stored within objects
  5. What is an uninitialized variable and what kind of behaviour can you expect from such a variable?
    A variable that has not been assigned a value with return undefined behavior
  6. What is undefined behaviour?
    Output that is a result of undefined variables
1 Like
  1. In C++ a variable is a named object , which stores value such as data.

  2. Definition of a variable is defining the usage of the variable with a keyword.

  3. Instantiation is the term for creating an object and assigning it a memory address.

  4. An r-value can’t have a value assigned to it , which means it can’t be on the left side of the " = " operator. An l-value is a value that has identified memory address.

  5. Uninitialized variable is a variable that hasn’t been given a value by the program . We can expect an undefined behavior .

  6. Undefined behavior is a result of the program’s misunderstanding.

1 Like
  1. A variable is a named object, which contains a value or some other properties
  2. A declaration statement to create a variable
  3. When the variable (object) is created an assigned a memory address
  4. l-value is the object, r-value is the ā€œvalueā€ to be represented by the l-value
  5. Uninitialized variables have not been given a known value, and could be assigned a random value
  6. The result of executing code with an uninitialized variable
1 Like

1 - In C++ a variable is a defined object.
2 - The definition of a variable states which data type the variable is.
3 - When the program is run the variable will be instationated - this is when the object is created and assigned a memory address.
4 - an lvalue is an object reference and an rvalue is a value
5 - A variable that has not been given a known value (usually through initialization or assignment) is called an uninitialized variable
6 - Undefined behavior is the result of executing code whose behavior is not well defined by the C++ language. This can arise from using an uninitialized variable.

1 Like
  1. a variable is an object created in c++

  2. we define variables using int a; which would define a variable named a.

  3. instantiation of a variable is when an object is created and given an memory address.

  4. an I-value points to a specific memory location. an R-value points to no specific location.

  5. it is a variable that has not been given a value. this will result in an undefined behavior.

  6. undefined behaviors are violations in the rule of C++. if there are undefined behaviors is C++ application, it will produce random results or not work.

1 Like
  1. What is a variable in C++?
    An object with a name.

  2. What is the Definition of a variable?
    A declaration statement in order to create variables.

  3. What is Instantiation of a variable?
    Assigning it to a memory address.

  4. What is the difference between an l-value and an r-value?
    An l-value is a permanent variable in which you can store information, the information stored in this variables are r-values.

  5. What is an uninitialized variable and what kind of behavior can you expect from such a variable?
    A set variable but that has not been assigned a value yet.

  6. What is undefined behavior?
    When the code has flaws but it is still running, making it have an undefined behavior.

1 Like