Day 3 Flashcards
Define Stack:
memory used by non-static local variables explicitly declared in a program
Define Freespace:
Memory set aside for stack, heap, and other uses
Define Heap:
- Dynamically allocated memory that is uninitialized at first.
- Slower than slack
Define BSS:
- Holds global and static variables that are uninitialized or initialized to 0.
- Exist throughout life of program
Define Data:
- Holds global and static variables initialized to a non-zero value.
- Exist throughout life of program
Define Text (memory layout):
• Stores compiled code of the currently running program.
Rules of Identifiers:
- Can only contain letters, numbers, and underscores (_)
* Cannot start with a number or be a syntactically reserved keyword of language
Variable initialization
= ;
What is an assignment operator?
Assigns a value to a variable.
Stream insertion variable vs. stream extraction operator?
Insertion = «_space;(cout) and extraction =»_space; (cin)
Programs 4 structural components
- Declarations – provides storage for the data a program is working with.
- Input – Allows acquisition of data from a source. Without it, program would only work with one set of data
- Processing- Process of manipulating the data in some manner to arrive at a result.
- Output- proves the processed data to a final destination, which could be a monitor, file on hard drive, or a network resource such as web page.
Define: Expressions
Combination of operators and values.
Define: Statements
Very common to see (;) following a statement.
Define: Code Blocks
Useful when statements require regrouping. Enclosed in {} curly braces
Explain: Comments
Single line comment // - compiler ignores everything after the comment until end of the line.
Multiple Line Comment /* */ - compiler ignores everything between opening and closing
What two terms are associated with Strings?
Index- the position in a string []. First index would be 0.
Element- an association to a position in string using a human recognized format. First element in array would be 1.
String is a special container object that can hold multiple characters.
What is a getline()?
Reads all data (including whitespace) up to the newline.
When you see this anywhere THINK INPUT (IN!!!!!!)
What is ws()?
Removes leading whitespace from the specified input stream. Placed prior to getline. When using getline and cin
What is Concatenation?
Process of joining two or more strings together.
What are the different methods of strings?
- Size() – determines how many bytes make up a string
- At() – return character in string using index number
- Find() – find first occurrence of sub-string in called string
- Compare() – compare string object to string passed as argument
- Empty() – test if string is empty. Returns true if empty, false if not
What are the different escape characters?
- \n – newline
- \t – tab character
- \0 – null character
- \” – double quote character
- \ - single backslash character
What are raw string literals?
Make each character in the string literal, meaning escape characters are not processed