Skip to main content
Engineering LibreTexts

4: Data and Operators

  • Page ID
    29046
    • 4.1: We Begin to Code...
    • 4.2: Data Types in C++
      Our interactions (inputs and outputs) of a program are treated in many languages as a stream of bytes. These bytes represent data that can be interpreted as representing values that we understand. Additionally, within a program we process this data in various ways such as adding them up or sorting them. This data comes in different forms.
    • 4.3: Identifier Names
      Within programming a variety of items are given descriptive names to make the code more meaningful to us as humans. These names are called "Identifier Names". Constants, variables, type definitions, functions, etc. when declared or defined are identified by a name.
    • 4.4: Constants and Variables
      Various textbooks describe constants using different terminology. Added to the complexity are the explanations from various industry professionals will vary greatly. Let's see if we can clear it up. A constant is a data item whose value cannot change during the program's execution. Thus, as its name implies – their value is constant.
    • 4.5: Data Manipulation
      Single values by themselves are important; however we need a method of manipulating values (processing data). Scientists wanted an accurate machine for manipulating values. They wanted a machine to process numbers or calculate answers (that is compute the answer). Prior to 1950, dictionaries listed the definition of computers as " humans that do computations". Thus, all of the terminology for describing data manipulation is math oriented.
    • 4.6: Assignment Operator
      The assignment operator allows us to change the value of a modifiable data object (for beginning programmers this typically means a variable). It is associated with the concept of moving a value into the storage location (again usually a variable). Within C++ programming language the symbol used is the equal symbol. But bite your tongue, when you see the = symbol you need to start thinking: assignment.
    • 4.7: L Value and R Value
      They refer to on the left and right side of the assignment operator. The L value (pronounced: L value) concept refers to the requirement that the operand on the left side of the assignment operator is modifiable, usually a variable. R value concept pulls or fetches the value of the expression or operand on the right side of the assignment operator.
    • 4.8: Sizeof Operator
      Every data item, constants and variables, not only have a data type, but the data type determines how many bytes the item will use in the memory of the computer. The size of each data type varies with the complier being used and the computer. This effect is known as being machine dependent.
    • 4.9: Arithmetric Operators
      This expression consists of one operator (addition) which has two operands. The first is represented by a variable named age and the second is a literal constant. If age had a value of 14 then the expression would evaluate (or be equal to) 15.
    • 4.10: Data Type Conversions
      Automatic conversion of a value from one data type to another by a programming language, without the programmer specifically doing so, is called implicit type conversion. It happens when ever a binary operator has two operands of different data types. Depending on the operator, one of the operands is going to be converted to the data type of the other. It could be promoted or demoted depending on the operator.
    • 4.11: Operator Overloading
    • 4.12: Unary Positive and Negative Operators
      Unary positive also known as plus and unary negative also known as minus are unique operators. The plus and minus when used with a constant value represent the concept that the values are either positive or negative.
    • 4.13: Bitwise Operators