CS 161 Midterm: CS 161 - Term Test 1

89 views27 pages

Document Summary

String literals and escape sequences: string literals are denoted with quotes , correct - cout << hello world << endl, escape characters to display special characters, denoted with , exp newline: cout << hello world\n ; Variables: location in memory, has name - can be anything, has type - see data types, indicates how much space needs to be carves out, declaration, statement requesting that memory be carved and named accordingly. How to name: declaring a variable gives the box a certain size to be, give a name to represent what is being stored there, start with letter: upper case, lower case, underscore. Bad 1234, my-var, 2eq_res: do not start variables with numbers, can"t use kewords. Like new because new has a terminal command. Assigning values to variables: point of variable is to hold data, declare a variable. Do not call it the equal sign!