Chapter 4 Literals, Variables, and Constants


Download 0.54 Mb.
bet2/6
Sana19.06.2023
Hajmi0.54 Mb.
#1626290
1   2   3   4   5   6
Bog'liq
Chapter-04

Character Representation

\n

Carriage return and line feed (new line)

\t

Tab (eight characters wide)

\"

Double quote

\'

Single quote

\\

Backslash

\0

Null character

4.2 Character Escape Sequences – Examples

cout << "One line\n Next Line\n";

cout << "\tHe said, \"Stop!\"";

// Output

One line

Next line

He said, "Stop!"

cout << "This is an apostrophe: ";

cout << '\'';

// Output

This is an apostrophe: '

4.3 Variable Declarations – Definition

  • Variable
  • A variable declaration has several purposes:
    • Informs operating system how much internal memory (RAM) the variable will need
    • Identifies the memory address to use for that variable
    • Identifies the type of data to be stored in that physical memory location
    • Indicates what operations (i.e., +, -, /, etc.) can be performed on the data contained within that variable

4.3 Variable Declarations – Syntax

4.3 Variable Declarations – Examples

int salary; // Notice the semicolon


Download 0.54 Mb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling